Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL statement error

Status
Not open for further replies.

leujel

Programmer
May 28, 2003
23
NL
I'm making a page that selects some data from a database. I've done this before, and it wasn't a problem, but now it is.... I've got this error:

Code:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E10)
[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1
/test/hbouw/_html_asp/foto.asp, line 26

The code on the line 26 (and some before that) is:

Code:
		Dim dag
		dag = request.querystring("dag")

		SQL = "SELECT * FROM tbl_foto WHERE weekdeel = " & dag & ""
		set RSfoto = conn.execute(SQL)

I tried a response.write on the request.querystring, and it isn't empty, so it has to work don't it??

Can anyone see whats wrong??

Visit
 
usual parameters are as follows:

'build database connection and query for the data
sql="select * from postcard where id=" & card

'set the coonection up
set conn = server.CreateObject ("adodb.connection")

'define the connection
conn="DSN=postcard;DATABASE=john;"

'create the recordset object
set objRS = server.CreateObject ("adodb.recordset")

'execute the query
objRS.Open sql, conn


also is dag a number or text value? if text the you will need to place single quotes around it

SQL = "SELECT * FROM tbl_foto WHERE weekdeel = '" & dag & "'"

note: if you're not dutch, you're not much

hth


Bastien

cat, the other other white meat
 
Thanks Bastien for your help. It worked the way you said it. It was a text string, so I had to use the single quotes. It's something I forget to do a lot! But you're never to old to learn!!!

Note: Nederland roeleert!! LOL!!

Visit
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top