|
-
Jun 16th, 2006, 03:57 PM
#1
Thread Starter
New Member
[RESOLVED] use request.form input in strSQL WHERE clause
Hello, I'm new to ASP and VBscript. I've been adding some new pages to our website, although I seem to be having some difficulties.
On Page 1, I have dropdowns for the user to select criteria, and upon clicking the Accept button on the webpage, it sends the user to Page 2 (a report page which should display a table of information from an Access database based on the criteria select by the user). I have an strSQL statement as follows, which is currently pulling all the records from the FeedStocks_Query. I would like to add a WHERE clause to have the SQL display only the data that matches the criteria the user entered from Page 1.
WORKING: but displaying all query records available
strSQL = "SELECT Commodity, Location, Low, Avg, High, LowFut, HighFut, AvgFut FROM FeedStocks_Query;"
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open xDb_Conn_Str
Set rsfeedtbl = conn.Execute(strSQL)
WHAT I'M AIMING FOR:
strSQL = "SELECT Commodity, Location, Low, Avg, High, LowFut, HighFut, AvgFut FROM FeedStocks_Query WHERE Commodity = " & Request.Form("feed_commodity") & ";"
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open xDb_Conn_Str
Set rsfeedtbl = conn.Execute(strSQL)
Using the second SQL statement gives me the following error:
Microsoft JET Database Engine error '80040e07'
Data type mismatch in criteria expression.
Any suggestions would be greatly appreciated! 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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|