M
Mangler
New at this so bare with me please....
I have a recordset on a page like so :
<%
Dim Recordset3__varT
Recordset3__varT = "0"
If (Request("textfield") <> "") Then
Recordset3__varT = Request("textfield")
End If
%>
<%
Dim Recordset3
Dim Recordset3_cmd
Dim Recordset3_numRows
Set Recordset3_cmd = Server.CreateObject ("ADODB.Command")
Recordset3_cmd.ActiveConnection = MM_conLogistics_STRING
Recordset3_cmd.CommandText = "SELECT sku, quantity FROM partsinventory
WHERE sku in (?)"
Recordset3_cmd.Prepared = true
Recordset3_cmd.Parameters.Append Recordset3_cmd.CreateParameter
("param1", 200, 1, 50, Recordset3__varT) ' adVarChar
Set Recordset3 = Recordset3_cmd.Execute
Recordset3_numRows = 0
%>
When the variable is something like "test" it works great. However it
is possible for the variable to look like this "test,test1" ( without
the quotes ). That explains the sql "in" operator in the query. This
is where i am having trouble. I know that in SQL to use "in", the
query should look like :
WHERE sku in ('test','test1')
So i modified the variable to do that like so :
<%
Dim Recordset3__varT
Recordset3__varT = "0"
If (Request("textfield") <> "") Then
Recordset3__varT = Replace("('" & Request("textfield"),",","','")&
"')"
End If
%>
Which when I do Request("Recordset3__varT") on the page it displays it
just as I need it. However, it is not working.
What am I doing wrong here? Can someone help me get this working?
I have a recordset on a page like so :
<%
Dim Recordset3__varT
Recordset3__varT = "0"
If (Request("textfield") <> "") Then
Recordset3__varT = Request("textfield")
End If
%>
<%
Dim Recordset3
Dim Recordset3_cmd
Dim Recordset3_numRows
Set Recordset3_cmd = Server.CreateObject ("ADODB.Command")
Recordset3_cmd.ActiveConnection = MM_conLogistics_STRING
Recordset3_cmd.CommandText = "SELECT sku, quantity FROM partsinventory
WHERE sku in (?)"
Recordset3_cmd.Prepared = true
Recordset3_cmd.Parameters.Append Recordset3_cmd.CreateParameter
("param1", 200, 1, 50, Recordset3__varT) ' adVarChar
Set Recordset3 = Recordset3_cmd.Execute
Recordset3_numRows = 0
%>
When the variable is something like "test" it works great. However it
is possible for the variable to look like this "test,test1" ( without
the quotes ). That explains the sql "in" operator in the query. This
is where i am having trouble. I know that in SQL to use "in", the
query should look like :
WHERE sku in ('test','test1')
So i modified the variable to do that like so :
<%
Dim Recordset3__varT
Recordset3__varT = "0"
If (Request("textfield") <> "") Then
Recordset3__varT = Replace("('" & Request("textfield"),",","','")&
"')"
End If
%>
Which when I do Request("Recordset3__varT") on the page it displays it
just as I need it. However, it is not working.
What am I doing wrong here? Can someone help me get this working?