-
Unable to query database: Error -> Too few parameters
Hello...
I'm having trouble running a database query. The exact error I am getting is as follows:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> >>
Error # = 80040E10
Description = [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.
Source = Microsoft OLE DB Provider for ODBC Drivers
SQL State = 07001
NativeError = -3010
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> >>
The code for the two asp files I am using is listed below.
Would anyone be able to explain why I am getting this error? It used to work fine until I changed something. I know that my ODBC connection is alright because I am able to page though the database properly thanks to MARK who responded to my previous post.
I would appreciate any help on this...
Thank you
=== FILE 1: RB-SEARCH.ASP ============================================
<% response.buffer=true %>
<!--ASP-db-->
<HTML>
<HEAD>
<title>rb-search.asp</title>
</HEAD>
<Body BGCOLOR=BLACK TEXT=White LINK=Black ALINK=Red VLINK=Black>
<CENTER><B>RADIO BUTTON SEARCH<P></B>
<HR WIDTH=66%>
<FORM NAME=THEFORM ACTION="rb-search-results.asp" METHOD=POST>
Please select the PictureCategory (piccat) that you want to see... <P>
<%
' <INPUT TYPE=RADIO NAME="CHOICE" VALUE="so" CHECKED> SO<BR>
%>
<INPUT TYPE=RADIO NAME="CHOICE" VALUE="so"> SO<BR>
<INPUT TYPE=RADIO NAME="CHOICE" VALUE="to"> TO<BR>
<INPUT TYPE=RADIO NAME="CHOICE" VALUE="hh"> HH<BR>
<INPUT TYPE=RADIO NAME="CHOICE" VALUE="ts"> TSBR>
<INPUT TYPE=RADIO NAME="CHOICE" VALUE="bb"> BB<BR><P>
<INPUT TYPE=SUBMIT NAME="SUBMIT" Value="SEARCH"> <BR>
</FORM>
</BODY>
</HTML>
=== FILE 2: RB-SEARCH-RESULTS.ASP =================================
<HEAD>
<title>rb-search-results.asp</title>
</HEAD>
<Body BGCOLOR=BLACK TEXT=Red LINK=Black ALINK=Red VLINK=Black>
<CENTER><B>RADIO BUTTON SEARCH RESULTS<P></B>
<HR WIDTH=66%>
<%
Set MyDb = Server.CreateObject("AspDB.Pro"
MyDb.dbDSN = "myimagedb"
MyDb.dbUnit = 1044
MyDb.DBColor = "4,auto,,,true" 'DEFINES COLOR SCHEME TO BE USED
MyDb.dbImageDir="images/" 'DEFINES NAVIGATION BUTTONS DIRECTORY
MyDb.dbGridTableTag = "border=0 cellspacing=5 cellpadding=5"
'DEFINE TAGS THAT GO INTO <TABLE...>
MyDb.DbMode = "grid" 'DEFINES OVERALL DISPLAY MODE
Mydb.dbGridCol = "3" 'DEFINES INITIAL NUMBER OF COLUMNS
MyDb.DbGridInc = "9" 'SETS GRID DISPLAY ROW INCREMENT (PAGE SIZE)
SELECTION=Request("CHOICE" ' Get what the user selects in the rb-search.asp program
response.write("PictureCategory (CHOICE) selected is: " & SELECTION & "<BR>" ' will be "so", "to", "hh", "ts" or "bb"
X = Session("CHOSEN"
if SELECTION = "so" then
Mydb.dbReset(1047)
MyDb.dbSQL="Select * FROM [pictures] WHERE piccat = 'so'"
Session("CHOSEN" = SELECTION
end if
if SELECTION = "to" then
Mydb.dbReset(1047)
MyDb.dbSQL="Select * FROM [pictures] WHERE piccat = 'to'"
Session("CHOSEN" = SELECTION
end if
if SELECTION = "hh" then
Mydb.dbReset(1047)
MyDb.dbSQL="Select * FROM [pictures] WHERE piccat = 'hh'"
Session("CHOSEN" = SELECTION
response.write("inside 3rd if"
end if
if SELECTION = "ts" then
Mydb.dbReset(1047)
MyDb.dbSQL="Select * FROM [pictures] WHERE piccat = 'ts'"
Session("CHOSEN" = SELECTION
end if
if SELECTION = "bb" then
Mydb.dbReset(1047)
MyDb.dbSQL="Select * FROM [pictures] WHERE piccat = 'bb'"
Session("CHOSEN" = SELECTION
end if
'FORMATS thpicpath FIELD TO DISPLAY THE JPG THUMBNAIL
mc = "picpath,align=center BGCOLOR=black,<A HREF=""#picpath#""><IMG BORDER=0 " 'WIDTH=100 HEIGHT=80
mc = mc + "VSPACE=0 HSPACE=0 SRC=""#thpicpath#"" ALT=""Click me to see a larger photo""></A>;"
MyDb.dbMagicCell = mc
MyDb.dbReset(1234) 'Make sure you are not using any old information - ie. clear session variable
MyDb.dbGridHideFlds = "picid,pset,picsize,thpicpath,piccat"
'HIDES FIELDS IN DB YOU DON'T WANT TO DISPLAY
MyDb.dbHeader = "false" 'HIDES HEADER FIELDS
MyDb.dbNavigation="both" 'PLACES NAVIGATION BUTTONS ON PAGE
MyDb.dbNavigationItem="top, bottom, next, prev"
'DEFINES WHICH NAVIGATIONS BUTTONS TO DISPLAY
MyDb.dbNavigationIcon="std" 'USE THE STANDARD NAVIGATION BUTTONS
MyDb.aspDBPro
%>
<P>
<CENTER>
<A HREF="rb-search.asp">Return to the radio button search screen</A>
</CENTER>
</BODY>
</HTML>
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
|
|