Forums

ASP

This topic is locked

request.QueryString problem

Posted 09 Jan 2003 02:26:22
1
has voted
09 Jan 2003 02:26:22 Paul Whitfield posted:
I'm trying to call a querystring "newsID" from a previous page to bring up a certain database record. However, I've been receiving this error "Data type mismatch in criteria expression" relating to my sql statement and I can't figure out why.

Here is what I have:

Dim conn, strSQL, rsNews

Set conn = Server.CreateObject("ADODB.Connection"
conn.open = MM_NewsDataBase_STRING

strSQL = "select * FROM tblnews " & _
"where ID =" & request.QueryString("newsID"

set rsNews = conn.Execute(strSQL)

The error keeps specifing a problem with the last line.
Can someone suggest what I'm doing wrong.

Replies

Replied 09 Jan 2003 13:45:43
09 Jan 2003 13:45:43 Owen Eastwick replied:
First try this:

strSQL = "select * FROM tblnews " & _
"where ID = " & request.QueryString("newsID" ' <--- Notice the extra space after the =

Then try this:

strSQL = "select * FROM tblnews " & _
"where ID = " & CInt(request.QueryString("newsID")


Regards

Owen.

Multiple Parameter UD4 / Access 2000 Database Search Tutorial:
www.tdsf.co.uk/tdsfdemo

Reply to this topic