PDA

View Full Version : ERROR when doing multiple parameters


mastajbl
10-19-2007, 05:52 PM
I get an too few parameters. expected 1. sometimes i receive a too few parameters expected 4. What i am trying to do is search 3 clumns of data in my database and display results per that search. i was able to get it to work with just one column search criteria, but when i try and add more WHERE it comes back errors. any ideas?

<%@LANGUAGE="JAVASCRIPT"%>
<!--#include virtual="/JBLFINAL/Connections/Standards.asp" -->
<%
var rsStandards__varSearch = "*";
if (String((Request.Form("search"))) != "undefined" &&
String((Request.Form("search"))) != "") {
rsStandards__varSearch = String((Request.Form("search")));
}
%>
<%
var rsStandards_cmd = Server.CreateObject ("ADODB.Command");
rsStandards_cmd.ActiveConnection = MM_Standards_STRING;
rsStandards_cmd.CommandText = "SELECT [APPLICATION], [GMNA STANDARDS], [JBL PART NUMBER], [DESCRIPTION], [PART CODE], REVISION FROM GMNA WHERE [JBL PART NUMBER] LIKE '*' + ? + '*' OR [GMNA] LIKE '*' + ? + '*' OR [PART CODE] LIKE '*' + ? + '*'
rsStandards_cmd.Prepared = true;
rsStandards_cmd.Parameters.Append(rsStandards_cmd. CreateParameter("param1", 200, 1, 255, rsStandards__varSearch)); // adVarChar
rsStandards_cmd.Parameters.Append(rsStandards_cmd. CreateParameter("param2", 200, 1, 255, rsStandards__varSearch)); // adVarChar
rsStandards_cmd.Parameters.Append(rsStandards_cmd. CreateParameter("param3", 200, 1, 255, rsStandards__varSearch)); // adVarChar
var rsStandards = rsStandards_cmd.Execute();
var rsStandards_numRows = 0;
%>
<%
var Repeat1__numRows = -1;
var Repeat1__index = 0;
rsStandards_numRows += Repeat1__numRows;
%>

mastajbl
10-19-2007, 07:12 PM
I get an error saying too few parameters expected 1. sometimes i receive a too few parameters expected 4. What i am trying to do is search 3 columns of data in my database and display results per that search. i was able to get it to work with just one column search criteria, but when i try and add more WHERE [JBL PART NUMBER] LIKE '*' + ? + '*' OR [GMNA] LIKE '*' + ? + '*' OR [PART CODE] LIKE '*' + ? + '*'
it comes back errors. any ideas?

davidj
10-19-2007, 10:10 PM
there are no asp gurus on this forum

sorry