Hi,
I am trying to create an ASP file which will search Multiple Values in a Database. Everything is fine if there is one parameter but if there are more I receive an SQL error message:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'Alt LIKE Pa_RaM000 OR WHERE Alt LIKE Pa_RaM001'.
Any help solving the problem would be appreciated (I am struggeling with it for almost 2 weeks and haven't managed to solve it).
the parameters come as a splited string (already splitted)
I am using the following code for parameter and query definition:
-
QString="SELECT PartNo, Alt, UNIT, QTY1 FROM Stock WHERE Alt LIKE ? "
-
-
for i=Lbound(Splitted) to Ubound(Splitted)
-
Recordset2__MMColParam=Splitted(i)
-
Recordset2_cmd.Prepared = true
-
set Param = Recordset2_cmd.CreateParameter("param"+chr(i), 200, 1, 255, "%" + Recordset2__MMColParam + "%") ' adVarChar
-
Recordset2_cmd.Parameters.Append(Param)
-
if i>0 then
-
QString = QString & "OR WHERE Alt LIKE ? "
-
end if
-
next
-
-
QString = QString & "ORDER BY Alt ASC"
-
Recordset2_cmd.CommandText=QString
-
Thanks,
Vesper Ventura