Results 1 to 11 of 11
  1. #1
    Join Date
    Mar 2003
    Posts
    21

    Unanswered: Recordset error 800a0bb9

    I know, I know this is really an ASP question but I'm thinking that you db gurus write some frontend code too. I have an ASP script (see snippet) that connects to my SQL Server 7 db (see connect string below).
    Code:
    16 sqlUser = "SELECT instructorId, schoolId, salutation, firstName, lastName, phone, email " & _
    17 "FROM tblInstructors " & _
    18 "WHERE (((userName)='"&Request.Form("userName")&"') AND ((password)='"&Request.Form("password")&"'))"
    19
    20 Set rsUser = Server.CreateObject("ADODB.RecordSet")
    21 rsUser.Open sqlUser, oConn
    This code runs fine as long as I key in a valid username and password. If I key in a bad username and password combo the db returns the following to my browser:

    ADODB.Recordset error '800a0bb9'
    Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.
    /loginProc.asp, line 21

    I tested by writing the finished sql to my browser and pasting it into the Enterprise manager and it runs as expected, I get a record with valid credentials and no record otherwise (but no error).

    I'm using SQL Server v7, can anyone shed any light on this? thanks

    connect string:
    Code:
    "Provider=sqloledb;" & _
    "Data Source=(local);" & _
    "Initial Catalog=GradeTrax;" & _
    "User ID=sa;" & _
    "Password=pword"

  2. #2
    Join Date
    Mar 2003
    Posts
    21
    Quote Originally Posted by dognation
    the db returns the following to my browser:
    Ok maybe its not the db returning this message but ADO. Still does anyone have any experience with this?

  3. #3
    Join Date
    Jul 2003
    Location
    SoCal
    Posts
    721
    What's the line immediately following 21 (empty lines excluded)?

    If you're attempting to pull a value from a recordset that is empty, you'll generate an error. Always make sure you're recordset actually contains records:

    Code:
    If NOT rsUser.BOF AND NOT rsUser.EOF Then
        'User is valid
    Else
        'User is invalid
    End If
    That which does not kill me postpones the inevitable.

  4. #4
    Join Date
    Mar 2003
    Posts
    21
    The next line I'm checking the status of EOF, however the line that is kicking the error is 21, so line 22 is never being processed.

  5. #5
    Join Date
    Jul 2003
    Location
    SoCal
    Posts
    721
    You don't need all the parens.. try:

    Code:
    "WHERE userName = '" & Request.Form("userName") & "' AND password = '" & Request.Form("password") & "'"
    As a note, this will make both the userName and password fields case sensitive. If you want to make just the userName case insensitive, use the keyword LIKE in place of the "=".
    That which does not kill me postpones the inevitable.

  6. #6
    Join Date
    Mar 2003
    Posts
    21
    Thanks Seppuku,
    This is really becoming very irritating. I've tried what you said and have in fact tried numerous variations, also using the Microsoft KB Article 235892 as guide and still can't get this to work. I've done response.write(sql) and pasted results here:

    Code:
    SELECT instructorId, schoolId, salutation, firstName, lastName, phone, email FROM tblInstructors WHERE userName LIKE 'dude' AND password LIKE 'badpassword'
    again I'm convinced that this is not an SQL thing but a ADO thing, and what makes me mad is that it works as long as the db returns at least one record and fails if no records match criteria.

    Any other info would be great.

  7. #7
    Join Date
    Mar 2003
    Posts
    21
    to all you coding comrads. I appologize for starting this thread. I stink as a programmer, I want to pump gas for a living or mow lawn or flip burgers or something.

    I had a piece of code further down that did a redirect if login failed that looped back on the same page instead of redirecting to the login page. My error message came when the page was loaded the second time with the form collection null. I hate it when computers do what you tell them to and not what you want them to.

  8. #8
    Join Date
    Jul 2003
    Location
    SoCal
    Posts
    721
    PEBCAK - Problem Exists Between Chair and Keyboard.
    That which does not kill me postpones the inevitable.

  9. #9
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Quote Originally Posted by dognation
    I hate it when computers do what you tell them to and not what you want them to.
    Me too, but the darned things keep right on doing it no matter how often I beat them!

    -PatP

  10. #10
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Quote Originally Posted by Seppuku
    PEBCAK - Problem Exists Between Chair and Keyboard.
    I like that! We call them id10t errors.

    -PatP

  11. #11
    Join Date
    Jul 2003
    Location
    SoCal
    Posts
    721
    Some great jargon came from early editions of WIRED magazine... PEBCAK was one of those.. unfortunately, they've fizzled out...
    That which does not kill me postpones the inevitable.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •