Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ADODB.Recordset error 800a0bb9

Status
Not open for further replies.

mmchenney

Technical User
May 16, 2001
16
0
0
US
Here is my error:
ADODB.Recordset error '800a0bb9'

Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.

/ta/test/calendar/admin/login.asp, line 34

Here is my code:

<!--#include file=&quot;dsn.asp&quot;-->
<%

Dim objConn
Set objConn = Server.CreateObject(&quot;ADODB.Connection&quot;)
objConn.open dsn

If Session(&quot;blnValidUser&quot;) = True and Session(&quot;Admin_ID&quot;) = &quot;&quot; Then
Dim rsPersonIDCheck
Set rsPersonIDCheck = Server.CreateObject(&quot;ADODB.Recordset&quot;)
Dim strSQL
strSQL = &quot;SELECT * FROM Settings WHERE Admin_ID = '&quot; & Session(&quot;Admin_ID&quot;) & &quot;';&quot;
rsPersonIDCheck.Open strSQL, objConn
If rsPersonIDCheck.EOF Then
Session(&quot;blnValidUser&quot;) = False
Else
Session(&quot;Admin_ID&quot;) = rsPersonIDCheck(&quot;Admin_ID&quot;)
End If
rsPersonIDCheck.Close
Set rsPersonIDCheck = Nothing
End If


Dim strID, strPassword
strID = Request(&quot;Admin_ID&quot;)
strPassword = Request(&quot;Password&quot;)

Dim rsUsers
set rsUsers = Server.CreateObject(&quot;ADODB.Recordset&quot;)
strSQL = &quot;SELECT * FROM Settings WHERE Admin_ID = '&quot; & strID & &quot;';&quot;
rsUsers.Open strSQL, objConn

If rsUsers.EOF Then
Session(&quot;Admin_ID&quot;) = Request(&quot;Admin_ID&quot;)
Response.Redirect &quot;default.asp?SecondTry=True&quot;
Else
While Not rsUsers.EOF
If UCase(rsUsers(&quot;Admin_Pass&quot;)) = UCase(strPassword) Then
Session(&quot;Admin_ID&quot;) = rsUsers(&quot;Admin_ID&quot;)
Session(&quot;isLoggedIn&quot;) = True
Session(&quot;blnValidUser&quot;) = True
Response.Redirect &quot;main.asp&quot;
Else
rsUsers.MoveNext
End If
Wend
Session(&quot;Admin_ID&quot;) = Request(&quot;Admin_ID&quot;)
Response.Redirect &quot;default.asp?SecondTry=True&WrongPW=True&quot;
End If
%>
<!--#include file=&quot;dsn2.asp&quot;-->

Molly
 
[tt]
First check this article:

Then

Bookmark this page:

[tt]&quot;A Successful man is one who can build
a firm foundation with the bricks
that others throw at him&quot;
[/tt]

banana.gif
rockband.gif
banana.gif
 
Are you sure the SQL statement in this section is right?

If Session(&quot;blnValidUser&quot;) = True and Session(&quot;Admin_ID&quot;) = &quot;&quot; Then
Dim rsPersonIDCheck
Set rsPersonIDCheck = Server.CreateObject(&quot;ADODB.Recordset&quot;)
Dim strSQL
strSQL = &quot;SELECT * FROM Settings WHERE Admin_ID = '&quot; & Session(&quot;Admin_ID&quot;) & &quot;';&quot;
rsPersonIDCheck.Open strSQL, objConn
If rsPersonIDCheck.EOF Then
Session(&quot;blnValidUser&quot;) = False
Else
Session(&quot;Admin_ID&quot;) = rsPersonIDCheck(&quot;Admin_ID&quot;)
End If
rsPersonIDCheck.Close
Set rsPersonIDCheck = Nothing
End If


You will only enter this section of code if the Session(&quot;Admin_ID&quot;) is empty, yet you SELECT where AdminID = Session(&quot;Admin_ID&quot;); this sql string will give you:

SELECT * FROM Settings WHERE Admin_ID = '';

Is that what you want?
 
One other addition from later in the code, this is not a fix, mainly justan effiency matter. If you change your second sql to select for password as well, then all you will need to do is check whether the recordset is eof or not rather than looping through it yourself.
Code:
Dim rsUsers
    set rsUsers = Server.CreateObject(&quot;ADODB.Recordset&quot;)
    strSQL = &quot;SELECT * FROM Settings WHERE Admin_ID = '&quot; & strID & &quot;' AND Admin_Pass Like '&quot; & strPassword & &quot;'&quot;   'used like to make it case insensitive, still needs to match the actual characters used though
    rsUsers.Open strSQL, objConn

    If rsUsers.EOF Then
        Session(&quot;Admin_ID&quot;) = Request(&quot;Admin_ID&quot;)
        Response.Redirect &quot;default.asp?SecondTry=True&quot;
    Else
        Session(&quot;Admin_ID&quot;) = rsUsers(&quot;Admin_ID&quot;)
        Session(&quot;isLoggedIn&quot;) = True
        Session(&quot;blnValidUser&quot;) = True
        Response.Redirect &quot;main.asp&quot;
    End If
-Tarwn ------------ My Little Dictionary ---------
Extreme Programming - (1)Trying to code before my second cup of coffee. (2) While(1){ Ctrl+C; Ctrl+V; }
Corrections - Comments made out of a desire to be helpful and repay the millions given to me :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top