|
-
Feb 3rd, 2001, 12:18 PM
#1
Thread Starter
Lively Member
Here is the problem. I have tried both the DSN method and the DSN-less method. but the thing is the DSN-less method doesn't seem to work properly; could not obtain the records in the database. These are my code. See if you could figure it out.
'DSN' method code :
___________________________________________________
Dim objConnect, objRecord, strQuery, text
Set objConnect = Server.CreateObject( "ADODB.Connection" )
Set objRecord = Server.CreateObject( "ADODB.RecordSet" )
Call objConnect.Open( "DSN=Student" )
strQuery = "SELECT * FROM Student WHERE " & _
"Username = '" & Request( "txtUser" ) & _
"' AND Password = '" & Request( "txtPass" ) & "'"
Call objRecord.Open( strQuery, objConnect, 1, 2 )
__________________________________________________
'DSN-less" Method Code :
______________________________________________
Dim objConnect, sConnString, strQuery, objRecord
Set objConnect = Server.CreateObject("ADODB.Connection")
sConnString = "DRIVER={Microsoft Access Driver (*.mdb)};" & _
"DBQ=" & Server.MapPath("\equuelus\db\Student.mdb") & ";"
objConnect.Open(sConnString)
strQuery = "SELECT * FROM Student WHERE " & _
"Username = '" & Request( "txtUser" ) & _
"' AND Password = '" & Request( "txtPass" ) & "'"
Set objRecord = objConnect.Execute(strQuery)
_________________________________________
The question is, does these two codes obtains the same records set? I get a different results. What is the problem?
I really appreciate any replys, thank you.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|