Results 1 to 4 of 4

Thread: "Too few parameters. Expected 1." ***?!?

  1. #1
    Guest
    Can anyone see what's wrong with this?
    Code:
    dim oConn, oRS
     
    Set oConn = Server.CreateObject("ADODB.Connection")
    oConn.ConnectionString = "DRIVER={Microsoft Access Driver (*.mdb)};"
    oConn.ConnectionString = oConn.ConnectionString & "DBQ=" & Server.MapPath("../datastore.mdb") & ";" oConn.ConnectionString = oConn.ConnectionString & "PWD=" & sDBPassword
    oConn.Open
     
    Set oRS = Server.CreateObject("ADODB.Recordset")
    oRS.Open "SELECT * FROM users WHERE username=" & request("user"), oConn
    I keep getting a "Too few parameters. Expected 1." error on the last line when I try to open the recordset.

  2. #2
    Lively Member
    Join Date
    Jun 2000
    Location
    Ontario, Canada.
    Posts
    85

    Cool

    I think it just has to do with your syntax.
    I guess that username must be a text field.
    So the data it is set equal to must be surrrounded in
    quotations.
    Like this:

    oRS.Open "SELECT * FROM users WHERE username = '" & request("user") & "'", oConn

    Hope this helps.



  3. #3
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Location
    Southeastern MI
    Posts
    4,367
    The too few parameters error is telling you that you have a field name or table name that is not in the database. Check to make sure you are using the correct names.

    Hope this helps

  4. #4
    Guest

    Thumbs up

    Cheers!

    Yeah...I hadn't put single quotes (') around the string in the sql statement... I had tried using double quotes and the sql engine thingy had rejected it... I didn't think about using single quotes. I tend to think of them as comment delimiters now...takes me back to my Pascal days.

Posting Permissions

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



Click Here to Expand Forum to Full Width