I have a very simple sql statement that is being created with a text variable transferred in via the URL.
Here is the error:
Microsoft OLE DB Provider for ODBC Drivers error '80040e10'
[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.
/admin/DBMaint/DBMod2Test.asp, line 19
Line 19 is rs.open sqlstmt, connectme
Here is a URL with domain removed:
http://www.xxxx.com/admin/DBMaint/DB...asp?ID=Amadeus
Here is the code that creates it:
<%
' use request.querystring to pass the ID
' number from the previous page to the
' sql statement so we get the right record
Cultivar = request.querystring ("ID")
response.write Cultivar
set rs=Server.CreateObject("adodb.Recordset")
connectme="DSN=flowerdata"
' note how the Cultivar name is added to the sql
'sqlstmt = "SELECT * from Flowers WHERE Cultivar = 'Alaqua'"
sqlstmt = "SELECT * from Flowers WHERE Cultivar =" &[Cultivar]
response.write sqlstmt
rs.open sqlstmt, connectme
' now get all the variables from the database
The commented out sql statement works, the second one that attempts to use a variable does not.
The output of the response.writes are as follows:
response.write Cultivar should display the value in URL
Amadeus
And it does...
response.write sqlstmt should display the sql statement, and it does
SELECT * from Flowers WHERE Cultivar =Amadeus
I used the brackets since some of the Cultivar variables will contain a space. I had this working fine passing a number variable, but I can't make it work with text.
Any help would be great
Thanks Matt