Discussion Locked

HTML>IIS>Cold Fusion>ODBC>Ac

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I have an Access 2K DB with a HTML form.
The form accepts info from the user and the user clicks on the submit button to send the form to the Access 2K DB.
Can someone tell me how to easily achieve this through the use of:cold fusion tags, sql (i already know this:-)) or some other
web/db connectivity.
The servers already have IIS, Cold Fusion, ASP configured correctly.
The db is for logging help desk calls and the form has 10 input boxes for: the users name, contact details and the problem they are experiencing.
if you need more info email me:
moorookoo@hotmail.com

5 replies

by jay eckles

I don't know Cold Fusion, but ASP is pretty easy to use for this type of task.

First, you'd open a connection to the database:

<%
Set oConn = Server.CreateObject("ADODB.Connection")

oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=c:\somepath\myDb.mdb;" & _
"User Id=admin;" & _
"Password=;"
%>

Then you execute a SQL statement (you can get the values of the input fields using Request.QueryString( "fieldname" ) ):

<%
Set rs = conn.Execute("INSERT INTO tablename VALUES( '"&Request.QueryString( "field1" )&"', ... ")
'replace "..." with the rest of your SQL!
%>

That's pretty much all there is to it. You'll probably want to add some error handlingand probably a response to the client, but that's trivial.

If you need some help, feel free to contact me.

Jay Eckles
www.jayeckles.com

by suzy_nas

This is also easy to do in ColdFusion.

Define your DataSource in ColdFusion Administrator:
Log in to the ColdFusion Administrator on your server and click the ODBC link, type your database name and choose the MS Access Driver, then click Add. Browse to your Database File and click Create.

Specify your DataSource in the Application.cfm (so it can be used by any query in this application):

On the form-processing page, your SQL would look something like this:

INSERT INTO TableName (Field1, Field2, Field3 ...)
VALUES (#Value1#, #Value2#, #Value3# ...)

I agree with Jay that you should add some error-handling and a response page. Try a CFTRY / CFCATCH Type="Database" tag set around your query.

Good Luck,
Suzy Naschansky

by lord foul

thanks a lot. all seems to be running ok. do you know of any good links to CF sites with examples?

This discussion is closed to new replies.