barryt
|
| Posted: 02/16/2002, 12:13 PM |
|
I am new to ASP and Database connections. I was able to get a connection to a database made for the following code as shown.
<%
End If
set conn = server.createobject("adodb.connection")
DSNtemp="DRIVER={Microsoft Access Driver (*.mdb)}; "
' set the actual path to the guestbook below - this example
' assumes that the guestbook is in the web server root
DSNtemp=dsntemp & "DBQ=" & server.mappath("/database/guestbook.mdb")
conn.Open DSNtemp
sqlstmt = "SELECT * from Guestbook ORDER BY PostDate DESC"
------- snip -------
How do I modify this code from the Employee database example to make it work??
---- snip --------
sHeaderFileName = sAppPath & "Header.html"
Set cn = Server.CreateObject("ADODB.Connection")
'Database connection string
strConn = "Provider=MSDASQL.1;Persist Security Info=False;User ID=;Data Source=empldir"
strLogin = ""
strPassword = ""
cn.open strConn, strLogin, strPassword
------- snip -----
Thanks
Barry
|
|
|
 |
Nicole
|
| Posted: 02/18/2002, 4:19 AM |
|
Barry,
as you use ASP and Access db on Site->Properties->Database tab->Server part select from 'Connection String Type' Create Automatically.
Or set it to Custom and enter connection string from your example:
DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & server.mappath("/database/guestbook.mdb")
|
|
|
 |
barryt
|
| Posted: 02/20/2002, 5:05 PM |
|
Hmmm not seeing my previous reply so I am trying again.
The orginal code
strConn = "Provider=MSDASQL.1;Persist Security Info=False;User ID=;Data Source=empldir"
strLogin = ""
strPassword = ""
cn.open strConn, strLogin, strPassword
My example DSNtemp seems to be close
DSNtemp="DRIVER={Microsoft Access Driver (*.mdb)}; "
DSNtemp=dsntemp & "DBQ=" & server.mappath("/database/guestbook.mdb")
conn.Open DSNtemp
Can the code that I know works be modified without codechanger?
CAn you show me the change required?
thanks
Barry
|
|
|
 |
Jack
|
| Posted: 02/21/2002, 1:29 AM |
|
Hello,
you know that your connection string work. Great! Select custom connection string within CC and enter your own one.
|
|
|
 |
VVritza
|
| Posted: 02/21/2002, 1:54 AM |
|
I have another problem...if someone can help me..please!
I made a connection to a MySQL database, , test OK!..But when I try to use some fields from a datbase table, I can't! I see al the table in my database, but I can't use any fields from it. Why? please help me...and another...I can'yt save in codecharge..I only can generate..but to save my work...nope...says "cant find file"..
ThX
|
|
|
 |
|