I believe this does what you're trying to do. I tried to simplify
your code a bit and get rid of the command object. (I wasn't sure why
you were using it other than trying to get agay from instantiating a
connection object?) This should work for you although I have not
executed it, so there may be errors. It's also been a while since
I've written classic ASP.
<%
Dim Recordset3
Dim Recordset3__varT
Dim objAdoConn
Recordset3__varT = "0"
If (Request("textfield") <> "") Then
Recordset3__varT = "'" & Replace(Request("textfield"), ",", "','") &
"'"
End If
Set objAdoConn = Server.CreateObject("ADODB.Connection")
objAdoConn.Open MM_conLogistics_STRING
Set Recordset3 = Server.CreateObject("ADODB.RecordSet")
Recordset3.Open "SELECT sku, quantity FROM partsinventory WHERE sku in
(" & Recordset3__varT & ")", objAdoConn, 3, 3
%>
You can clean it up a bit by getting rid of the connection I added,
but I wanted to show the complete code.
Let me know if this works for you.
-Steve
On Jan 8, 11:13*am, Mangler <webmas...@repairresource.com> wrote:
> 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?