PDA

View Full Version : SQL statement queries Access database in ASP


bluegenel
12-07-2008, 10:18 AM
Hi

I have an ASP form/page that submits one field called "dropdown" to an ASP pages where a connection to an Access 2000 database happens.

I am trying to query the database using the SQL statement so only certain records are displayed.

I want to have a string included in the statement so the info from the dropdown box determines the SQL string.

I can't get it to work.


It displays this error message:-

Microsoft OLE DB Provider for ODBC Drivers error '80040e10'

[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.

/30/inbox/header_body.asp, line 78



Here is the code in my page:-

Dim strdropdown

set strdropdown = request.form("dropdown")

strSQLupdatesel = "SELECT Table2.* FROM Table2 WHERE (Table2.Name = strdropdown);"


Thanks in advance.

Richard

SouthwaterDave
12-07-2008, 03:12 PM
Try changing your last line to:
strSQLupdatesel = "SELECT * FROM Table2 WHERE Name = '" & Request.Form("dropdown") & "'"

bluegenel
12-07-2008, 03:44 PM
Thank you SouthwaterDave. That worked brilliant!!