PDA

Click to See Complete Forum and Search --> : "Too few parameters. Expected 1." ***?!?


Jun 22nd, 2000, 06:27 PM
Can anyone see what's wrong with this?
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.

Jimmer
Jun 22nd, 2000, 09:06 PM
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.

Negative0
Jun 22nd, 2000, 11:38 PM
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

Jun 23rd, 2000, 03:57 PM
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.