Results 1 to 3 of 3

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
    Fanatic Member Ianpbaker's Avatar
    Join Date
    Mar 2000
    Location
    Hastings
    Posts
    696

    Question

    Hi matthewralston

    Is yor username a string, because if it is you need to enclose the where Clause in '.


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

    Hope this helps

    Ian

    Yeah, well I'm gonna build my own lunar space lander! With blackjack aaaaannd Hookers! Actually, forget the space lander, and the blackjack. Ahhhh forget the whole thing!

  3. #3
    Guest
    Ah, yeah...cheers. I wondered if it might be that but I couldn't figure out what delimiters to use for a string...

    ' hey? takes me back to pascal used to usin them as comments now

    Thanks.

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