Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to resolve an ODBC Error Code = 07001 in my query?

Status
Not open for further replies.

trideryck

MIS
Jun 20, 2005
10
0
0
US
I have a simple (and crude, I know) query that had been working for many years on my webpage that recently "broke". It searches my database based on country, state, and county. Can someone lend their thoughts and suggestions? I've listed the form and result html with the coldfusion pages below. The error I'm getting when I submit the countrysearch.cfm form with a valid country is:

Error:

Error Diagnostic Information

ODBC Error Code = 07001 (Wrong number of parameters)

[Microsoft][ODBC dBase Driver] Too few parameters. Expected 1.

Hint: The cause of this error is usually that your query contains a reference to a field which does not exist. You should verify that the fields included in your query exist and that you have specified their names correctly.

The error occurred while processing an element with a general identifier of (CFQUERY), occupying document position (3:1) to (3:48).

Date/Time: 03/02/11 15:22:45
Browser: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/534.13 (KHTML, like Gecko) Chrome/9.0.597.107 Safari/534.13

countrysearch.cfm
----
<!DOCTYPE HTML PUBLIC>

<html>
<head>
<title>Research Database Query</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head>

<body bgcolor = #ffefdb background="../Images/backgroundsand.gif">
<h2>Search for research items</h2>

<p>
<blockquote>
Enter your search criteria in the fields below.<br>
Country is required; state and county will help to restrict the search.<br>
</p>

<form action="countryresults.cfm" method="get">
<table border = "0">
<tr>
<P>
<td>Country</td>
<td><input name="findcountry"></td>
</tr>
<tr>
<td>State</td>
<td><input name="findstate">
</tr>
<tr>
<td>County</td>
<td><input name="findcounty">
</tr>
<p>
</table>
<p>
<input type="submit" value="Search">
<INPUT type=reset value=Reset>&nbsp;
</blockquote>
</P>

</form>
</body>
</html>
---

countryresults.cfm

<!DOCTYPE HTML PUBLIC>

<cfset findcountry=UCASE(findcountry)>
<cfset findstate=UCASE(findstate)>
<cfset findcounty=UCASE(findcounty)>

<CFIF "#findcountry#" IS "USA">
<CFSET findcountry = "UNITED STATES">
</CFIF>

<CFQUERY NAME="GetRecords" datasource="research">
select catnum, firstname, lastname, country, state, county, colldate, tissues, IDnum
from research
where country = "#findcountry#"
<CFIF "#findstate#" IS NOT "">
and state = "#findstate#"
</CFIF>
<CFIF "#findcounty#" IS NOT "">
and county like "#findcounty#%"
</CFIF>
order by state, county, lastname, firstname, catnum
</cfquery>


<html>
<head>
<title>Query Results</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head>

<body bgcolor=#ffefdb background="../Images/backgroundsand.gif">
<h2>Results Page</h2>

<CFIF 0 is #GetRecords.RecordCount#>

<blockquote>
<cfoutput>
<cfif "#findcountry#" is "">
Please enter a value in the country field.
<cfelse>
We're sorry, there are no records in the database that match "#findcountry#, #findstate#, #findcounty#"
</cfif>
</cfoutput>
</blockquote>

</table>
<p>
<blockquote>
<table border = "0" cellpadding = 7>
<tr>
<td><A href="countrysearch.cfm">Try a New Search</a></td>
<td><A href="INDEX.HTM">Return to Search Page</a></td>
</tr>
</table>
</blockquote>
</P>

<CFELSE>
<p>
<blockquote>
<CFOUTPUT>Your search took #CFQuery.ExecutionTime# milliseconds<br>
and returned
#GetRecords.RecordCount# specimen records.
</CFOUTPUT>
</blockquote>
<P></P>

<table bgcolor = #ffffff BORDER = "0">
<tr>
<th WIDTH = 150><P align=left><FONT face=Arial color=#0000cc size=1>Country</FONT></P></th>
<th WIDTH = 150><P align=left><FONT face=Arial color=#0000cc size=1>State</FONT></P></th>
<th WIDTH = 150><P align=left><FONT face=Arial color=#0000cc size=1>County</FONT></P></th>
<th WIDTH = 115><P align=left><FONT face=Arial color=#0000cc size=1>Last Name</FONT></P></th>
<th WIDTH = 125><P align=left><FONT face=Arial color=#0000cc size=1>First Name</FONT></P></th>
<th WIDTH = 150><P align=left><FONT face=Arial color=#0000cc size=1>Collection Date</FONT></P></th>
<th WIDTH = 100><P align=left><FONT face=Arial color=#0000cc size=1>Catalog Number</FONT></P></th>
<th WIDTH = 50><P align=left><FONT face=Arial color=#0000cc size=1>Tissues</FONT></P></th>
</tr>

<cfoutput query="GetRecords">
<tr>
<td><font Face=Arial size="1">#country#</font></td>
<td><font Face=Arial size="1">#state#</font></td>
<td><font Face=Arial size="1">#county#</font></td>
<td><EM><font Face=Arial size="1">#lastname#</font></EM></td>
<td><EM><font Face=Arial size="1">#firstname#</font></EM></td>
<cfif #colldate# is not "1899/12/30">
<td><font Face=Arial size="1">#colldate#</font></td>
<cfelse>
<td>&nbsp;</td>
</cfif>
<td><font Face=Arial size="1">Cat. #catnum#</font></FONT></td>

<cfif #tissues# is 1>
<td><font Face=Arial size="1">ID #IDnum#</font></td>
<cfelse>
</CFIF>
</tr>
</CFOUTPUT>

</table>
<p>
<blockquote>
<table border = "0" cellpadding = 7>
<tr>
<td>Export Records</td>
<td>Print</td>
<td><A href="countrysearch.cfm">New Locality Search</a></td>
<td><A href="INDEX.HTM">Return to Search Page</a></td>
</tr>
</table>
</blockquote>
</P>

</CFIF>

</body>
</html>





 
Other than the double instead of single quotes, nothing jumps out at me. Obviously things do not just break ;-) So what has changed recently: code, database table, drivers, etcetera?

----------------------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top