Click to See Complete Forum and Search --> : convert to DSN less ??


mdb
02-12-2005, 05:50 PM
I have an example here that I need to convert to DSN less.
can somebody help me out?
Thanks

I think the dsn is autoexample

<!-- #include file="adovbs.inc" -->
<%
' Create a RecordSet object
Set Rs = Server.CreateObject("ADODB.RecordSet")

' Open the table
Rs.Open "tUsers", "AutoExample", adOpenKeySet, adLockPessimistic, adCmdTable

' Add a new record
Rs.AddNew
Rs("UserName") = Request.Form("USERNAME")
Rs("UserEmail") = Request.Form("USEREMAIL")

' Update the record
Rs.Update

' Retrive the ID
lUserID = Rs("UserID")

' Close the RecordSet
Rs.Close
Set Rs = Nothing

%>
<HTML>
<BODY BGCOLOR=FFFFFF>
<H3>Autonumber Example</H3>
<P>
Thank you, <% =Request.Form("USERNAME") %>! Your ID is <% =lUserID %>.
</P>


</BODY>
</HTML>

buntine
02-12-2005, 10:33 PM
Dim strConnString, conn
strConnString = "Driver={Microsoft Access Driver (*.mdb)}" & _
";DBQ=" & Server.MapPath("pathOfDatabase")
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open(strConnString)
Set Rs = Server.CreateObject("ADODB.RecordSet")
Rs.Open "yourSQL", conn, adOpenKeySet, adLockPessimistic, adCmdTable

You may need to consult your DSN to find out the path and name of the database.

Regards.