PDA

Click to See Complete Forum and Search --> : [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.


tsgorrie
Jan 26th, 2000, 02:26 AM
Check the spelling of your field and table names - ie if you type SCHOL instead of SCHOOL, the query engine will think the SCHOL is a parameter

Use square brackets around any table/field names which contain spaces ie [SCHOOL ID], but you "" around values

iE WHERE [SCHOOL NAME]="D B CORP"

HakanAzaklioglu
Jan 26th, 2000, 11:20 AM
Newbie needs assitance... Any help would be appreciated here is my error message:


Microsoft OLE DB Provider for ODBC Drivers error '80040e10'
[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.

/888.asp, line 90

My code is as follows:

<%@ LANGUAGE="VBSCRIPT" %>
<HTML>
<HEAD>

<%Manufacturer = Request.Form("Manufacturer")%>
<META NAME="GENERATOR" Content="Microsoft Visual InterDev 1.0">
<META HTTP-EQUIV="Content-Type" content="text/html; charset=iso-8859-1">
<TITLE>Visual InterDev &ltSELECT&gt Sample</TITLE>
</HEAD>
<BODY bgcolor="#FFFFFF">
<p><font size="6"><strong>Auto Listing Page</strong></font></p>
<p> </p>
<!--METADATA TYPE="DesignerControl" startspan
<OBJECT ID="DataCommand1" WIDTH=151 HEIGHT=24
CLASSID="CLSID:7FAEED80-9D58-11CF-8F68-00AA006D27C2">
<PARAM NAME="_Version" VALUE="65536">
<PARAM NAME="_Version" VALUE="65536">
<PARAM NAME="_ExtentX" VALUE="3986">
<PARAM NAME="_ExtentY" VALUE="635">
<PARAM NAME="_StockProps" VALUE="0">
<PARAM NAME="DataConnection" VALUE="DataConn">
<PARAM NAME="CommandText" VALUE="SELECT `Location` FROM CIEmpdir2">
</OBJECT>
-->
<%
Set DataConn = Server.CreateObject("ADODB.Connection")
DataConn.ConnectionTimeout = Session("DataConn_ConnectionTimeout")
DataConn.CommandTimeout = Session("DataConn_CommandTimeout")
DataConn.Open "ASPBook", "sa", "yourpassword"
Set cmdTemp = Server.CreateObject("ADODB.Command")
Set DataCommand1 = Server.CreateObject("ADODB.Recordset")
cmdTemp.CommandText = "SELECT `Location` FROM CIEmpdir2"
cmdTemp.CommandType = 1
Set cmdTemp.ActiveConnection = DataConn
DataCommand1.Open cmdTemp, , 0, 1
%>
<!--METADATA TYPE="DesignerControl" endspan-->
<p>Select the manufacturer:</p>
<FORM METHOD="POST" Action="888.asp" NAME="Form1">
<SELECT LANGUAGE="JavaScript" ONCHANGE="Form1.submit()" SIZE=1 NAME="Manufacturer">

<!-- Fill the <SELECT> list with values from the Manufacturers table -->
<% Do While Not DATACommand1.EOF %>
<%If Manufacturer = DataCommand1("Location") then%>
<OPTION SELECTED>
<%= DataCommand1("Location")%>
</option>
<%Else%>
<OPTION>
<%= DataCommand1("Location")%>
</option>
<%End if%>
<% DataCommand1.MoveNext
Loop %>

</SELECT>
</FORM>
<%if Manufacturer = "" then Manufacturer = "HEADQUARTERS" %>
<p><strong>Cars Offered by <%=Manufacturer%> :</strong></p>
<table border="1">
<tr>
<td align="center"><strong>Location </strong></td>
<td align="center"><strong>ID </strong></td>
<td align="center"><strong>WPhone </strong></td>
<td align="center"><strong>WFax </strong></td>
<td align="center"><strong>MGREmail </strong></td>
</tr>
<!--METADATA TYPE="DesignerControl" startspan
<OBJECT ID="DataCommand2" WIDTH=151 HEIGHT=24
CLASSID="CLSID:7FAEED80-9D58-11CF-8F68-00AA006D27C2">
<PARAM NAME="_Version" VALUE="65536">
<PARAM NAME="_Version" VALUE="65536">
<PARAM NAME="_ExtentX" VALUE="3986">
<PARAM NAME="_ExtentY" VALUE="635">
<PARAM NAME="_StockProps" VALUE="0">
<PARAM NAME="DataConnection" VALUE="DataConn">
<PARAM NAME="CommandText" VALUE="SELECT CIEmpdir2.`Location`, Stores.Store_ID, Stores.WPhone FROM Stores, CIEmpdir2 WHERE Stores.ID = CIEmpdir2.ID AND (CIEmpdir2.`Location` = '[Manufacturer]')">
</OBJECT>
-->
<%
Set DataConn = Server.CreateObject("ADODB.Connection")
DataConn.ConnectionTimeout = Session("DataConn_ConnectionTimeout")
DataConn.CommandTimeout = Session("DataConn_CommandTimeout")
DataConn.Open "ASPBook", "sa", "yourpassword"
Set cmdTemp = Server.CreateObject("ADODB.Command")
Set DataCommand2 = Server.CreateObject("ADODB.Recordset")
cmdTemp.CommandText = "SELECT CIEmpdir2.`Location`, Stores.Store_ID, Stores.WPhone FROM Stores, CIEmpdir2 WHERE Stores.ID = CIEmpdir2.ID AND (CIEmpdir2.`Location` = '" & Manufacturer & "')"
cmdTemp.CommandType = 1
Set cmdTemp.ActiveConnection = DataConn
DataCommand2.Open cmdTemp, , 0, 1
%>
<!--METADATA TYPE="DesignerControl" endspan-->

<% Do While Not DATACommand2.EOF %> <tr>
<td><input type="text" name="Store_ID" size="20" value="<%= DataCommand2("Store_ID") %>"></td>
<td><input type="text" name="WPhone" size="20" value="<%= DataCommand2("WPhone") %>"></td>
<td><input type="text" name="WFax" size="20" value="<%= DataCommand2("WFax") %>"></td>
<td><input type="text" name="MGREmail" size="20" value="<%= DataCommand2("MGREmail") %>"></td>
</tr>
<%
DataCommand2.MoveNext
Loop
%>
</table>
</BODY>
</html>