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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Too few parameters. Expected 1. 1

Status
Not open for further replies.

melusi

IS-IT--Management
Jul 31, 2002
13
ZA
The ASP file I have has the first 11 lines as follows:
<!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 3.2 Final//EN&quot;>

<%@ Language = VBscript %>
<%

set conn = Server.CreateObject(&quot;ADODB.Connection&quot;)
conn.Open &quot;KDDP&quot;
SQL=&quot;SELECT Count(MemberName) AS AssocName,CountOfMemberName FROM FarmAssocMembers &quot; &_
&quot;GROUP BY AssocName &quot; &_
&quot;HAVING (((AssocName) <> 'Check'))&quot;
set cars=conn.execute(SQL)

%>
and I get the Error message
Too few parameters. Expected 1.
Please help
 
Hmm, this may be a problem with your SQL statement. When it is executed it is not returning any results. It appears that you have an error in the select stmt:
Shouldn't this:
Code:
SQL=&quot;SELECT Count(MemberName) AS AssocName,CountOfMemberName FROM FarmAssocMembers &quot; &_
&quot;GROUP BY AssocName &quot; &_
&quot;HAVING (((AssocName) <> 'Check'))&quot;
be this:
Code:
SQL=&quot;SELECT Count(MemberName) AS CountOfMemberName,AssocName FROM FarmAssocMembers &quot; &_
&quot;GROUP BY AssocName &quot; &_
&quot;HAVING (((AssocName) <> 'Check'))&quot;
Right now you asking it to count the recordas and call it AssocName and also select this unknown field called CountOfMemberName, simple case of backwards, switch them and that portion ought ot be ok.
You should also have an Option Explicit at top and be declaring all of your variables. This will help you with debugging and catching mispelled variable names.
The Doctype tag should not be there at the top. In this case you will want the opening asp tag to be first with the @Language declaration, like so:
Code:
<%@ Language = VBscript %>
<%
Option Explicit
Dim conn, SQL, cars

set conn = Server.CreateObject(&quot;ADODB.Connection&quot;)
conn.Open &quot;KDDP&quot;
SQL=&quot;SELECT Count(MemberName) AS CountOfMemberName,AssocName FROM FarmAssocMembers &quot; &_
&quot;GROUP BY AssocName &quot; &_
&quot;HAVING (((AssocName) <> 'Check'))&quot;
set cars=conn.execute(SQL)

%>

Give that a try and let us know how it goes.
-Tarwn ------------ My Little Dictionary ---------
Extreme Programming - (1)Trying to code before my second cup of coffee. (2) While(1){ Ctrl+C; Ctrl+V; }
FAQ - Web-ese for &quot;Forget Asking Questions, I am to busy&quot; :p
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top