If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > ASP ADO Connection

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-15-05, 19:08
sasa82 sasa82 is offline
Registered User
 
Join Date: Nov 2005
Posts: 1
ASP ADO Connection

Urgent! PLEASE HELP!

I couldn't figure out what's the errors of my coding..

<%
Dim rsLogin, rsTime, strConn

strConn="Provider=Microsoft.Jet.OLEDB.4.0;" &_
"Data Source=" & Server.MapPath("Users.mdb")

Set rsLogin = Server.CreateObject("ADODB.Recordset")
Set rsTime = Server.CreateObject("ADODB.Recordset")

'Get userid and password'
userid = Request.Form("uid")
password = Request.Form("pwd")

'Assume an invalid logon'
validLogon = False

'Construct SQL Statement'
SQLCommand1 = "Select * From Acc Where UserName = '" _
& userid & "'"
SQLCommand2 = "Select * From LogFile"

rsLogin.Open SQLCommand1, strConn, 1, 3
rsTime.Open SQLCommand2, strConn, 2, 3

If Not rsLogin.EOF And Not rsLogin.BOF Then
If password = obj.Fields("Password") Then
validLogon = true
Response.Direct "menu.asp"
rsTime.Close
set rsTime = nothing
Else
response.redirect "loginerror.asp"
End If
Else
response.redirect "loginerror.asp"
End if

rsLogin.Close
set rsLogin = nothing
%>

Error Type:
Microsoft JET Database Engine (0x80004005)
Could not use ''; file already in use.
/Web 051114/login.asp, line 23

Anyone knows what is going on with the coding?

Thanks
Reply With Quote
  #2 (permalink)  
Old 11-16-05, 15:34
bunzo bunzo is offline
Registered User
 
Join Date: Apr 2005
Posts: 28
Why do you Close rslogin and set it to nothing but you don't do the same for the other Recordset you opened.... rstime...?

Quote:
Originally Posted by sasa82
Urgent! PLEASE HELP!

I couldn't figure out what's the errors of my coding..

<%
Dim rsLogin, rsTime, strConn

strConn="Provider=Microsoft.Jet.OLEDB.4.0;" &_
"Data Source=" & Server.MapPath("Users.mdb")

Set rsLogin = Server.CreateObject("ADODB.Recordset")
Set rsTime = Server.CreateObject("ADODB.Recordset")

'Get userid and password'
userid = Request.Form("uid")
password = Request.Form("pwd")

'Assume an invalid logon'
validLogon = False

'Construct SQL Statement'
SQLCommand1 = "Select * From Acc Where UserName = '" _
& userid & "'"
SQLCommand2 = "Select * From LogFile"

rsLogin.Open SQLCommand1, strConn, 1, 3
rsTime.Open SQLCommand2, strConn, 2, 3

If Not rsLogin.EOF And Not rsLogin.BOF Then
If password = obj.Fields("Password") Then
validLogon = true
Response.Direct "menu.asp"
rsTime.Close
set rsTime = nothing
Else
response.redirect "loginerror.asp"
End If
Else
response.redirect "loginerror.asp"
End if

rsLogin.Close
set rsLogin = nothing
%>

Error Type:
Microsoft JET Database Engine (0x80004005)
Could not use ''; file already in use.
/Web 051114/login.asp, line 23

Anyone knows what is going on with the coding?

Thanks
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On