-
Too Few Parameters
I am trying to search an access database using vbscript.
I am writing my code in front page 98.
The query gets it's parameters from a text box and a selection list.
The query works if the user inputs something into the text box and the selection list.
It even works if something is chosen from the selection list and the text box is left empty.
If someone enters something into the text box,
and does not choose something from the selection list I get this error:
Microsoft OLE DB Provider for ODBC Drivers error '80040e10'
[Microsoft][ODBC Microsoft Access 97 Driver] Too few parameters. Expected 1.
Here is my code:
<html>
<!--#INCLUDE FILE= CkflgStore.inc -->
<!--#INCLUDE FILE= adovbs.inc -->
<!--#include file= RecToTable.asp-->
<!--#include file= ListBox.asp-->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Search</title>
</head>
<body>
<%
Dim objRecSeries 'Recordset to produce selection list on form
Dim objRec 'Recordset Produced by Query
Dim strDriver 'Parameter: Contents of textbox on form
Dim strSeries 'Parameter: Contents of selection list on form
Dim objCommand 'Command to Produce objRec
Dim strSql 'SQL String
strDriver= Request.form("Driver"
strSeries= Request.Form("series"
set objRecSeries= Server.CreateObject ("ADODB.Recordset"
objRecSeries.open "tblSeries",strconn,adOpenDynamic,adLockRe adOnly,adCmdTable
'This include file is a function that makes a txtBox and Selection list
response.write ListBox (objRecSeries)
strSql="SELECT * FROM tblCollectible "
'build SQL statement according to what user chooses
' "Choose a Series" is the default for Selection List and means nothing was 'chosen
if strSeries = "Choose a Series" then
if strDriver <> "" then
strSql= strSql & " WHERE strDriver= '"&strDriver&"' "
else
Response.write "<center><h2>Please Specify Search Criteria</h2></center>"
end if
else
if strDriver <> "" then
strSql= strSql & " WHERE Driver= '"&strDriver&"' and SeriesName='"&strSeries&"'"
else
strSql= strSql & " WHERE SeriesName= '"&strSeries&"' "
end if
end if
'Create Command
Set objCommand= Server.CreateObject ("ADODB.Command"
objCommand.ActiveConnection= strConn
objCommand.CommandText= strSql
objCommand.CommandType= adCmdText
'Create recordset to be displayed
Set objRec=Server.createobject ("ADODB.Recordset"
set objRec= objCommand.Execute
'call function to write data to a table
Response.Write RecToTable (objRec)
objRec.Close
Set objRec=Nothing
%>
</body>
</html>
I need work out this little kink
any help would be greatly appreciated
Thanks,
Adam Perfetti
adam@trinityhosting.com
-
Too Few Parameters (reply)
Hi Adam,
This board is for discussion about questions on ASP-db which is a tool which does all that hard work you're doing for you! You'll need to post your question on the ASP support forum. You can check out ASP-db at www.aspdb.com
Thanks,
John
------------
Adam P. at 3/26/99 1:21:53 PM
I am trying to search an access database using vbscript.
I am writing my code in front page 98.
The query gets it's parameters from a text box and a selection list.
The query works if the user inputs something into the text box and the selection list.
It even works if something is chosen from the selection list and the text box is left empty.
If someone enters something into the text box,
and does not choose something from the selection list I get this error:
Microsoft OLE DB Provider for ODBC Drivers error '80040e10'
[Microsoft][ODBC Microsoft Access 97 Driver] Too few parameters. Expected 1.
Here is my code:
<html>
<!--#INCLUDE FILE= CkflgStore.inc -->
<!--#INCLUDE FILE= adovbs.inc -->
<!--#include file= RecToTable.asp-->
<!--#include file= ListBox.asp-->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Search</title>
</head>
<body>
<%
Dim objRecSeries 'Recordset to produce selection list on form
Dim objRec 'Recordset Produced by Query
Dim strDriver 'Parameter: Contents of textbox on form
Dim strSeries 'Parameter: Contents of selection list on form
Dim objCommand 'Command to Produce objRec
Dim strSql 'SQL String
strDriver= Request.form("Driver"
strSeries= Request.Form("series"
set objRecSeries= Server.CreateObject ("ADODB.Recordset"
objRecSeries.open "tblSeries",strconn,adOpenDynamic,adLockRe adOnly,adCmdTable
'This include file is a function that makes a txtBox and Selection list
response.write ListBox (objRecSeries)
strSql="SELECT * FROM tblCollectible "
'build SQL statement according to what user chooses
' "Choose a Series" is the default for Selection List and means nothing was 'chosen
if strSeries = "Choose a Series" then
if strDriver <> "" then
strSql= strSql & " WHERE strDriver= '"&strDriver&"' "
else
Response.write "<center><h2>Please Specify Search Criteria</h2></center>"
end if
else
if strDriver <> "" then
strSql= strSql & " WHERE Driver= '"&strDriver&"' and SeriesName='"&strSeries&"'"
else
strSql= strSql & " WHERE SeriesName= '"&strSeries&"' "
end if
end if
'Create Command
Set objCommand= Server.CreateObject ("ADODB.Command"
objCommand.ActiveConnection= strConn
objCommand.CommandText= strSql
objCommand.CommandType= adCmdText
'Create recordset to be displayed
Set objRec=Server.createobject ("ADODB.Recordset"
set objRec= objCommand.Execute
'call function to write data to a table
Response.Write RecToTable (objRec)
objRec.Close
Set objRec=Nothing
%>
</body>
</html>
I need work out this little kink
any help would be greatly appreciated
Thanks,
Adam Perfetti
adam@trinityhosting.com
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
|
|