R
r3net
I need to pass a parameter @item to a stored procedure
and get back a selection based on value(s) contained in
@item.
@item is a collection of selected items in a listbox as
follows...
ArrayList alItems = new ArrayList();
foreach(ListItem li in listbboxItems.Items)
{
if(li.Selected == true)
alItems.Add (li.Value);
}
Questions...
1. How do I define the SqlDbType for an array and assign
aiItems to it?
ie...Item_Command.Parameters.Add("@item",
SqlDbType.VarChar, 250).Value = aiItems.ToString();
note: I am using "VarChar, 250" only to clarify my
question.
2. How do I define @items in SQL so that the following
would result
SELECT * FROM tbl WHERE tbl.items IN @item
***or/same as***
SELECT * FROM tbl WHERE tbl.items IN ('AR', 'BC', 'mBR')
Thanks,
Koy
and get back a selection based on value(s) contained in
@item.
@item is a collection of selected items in a listbox as
follows...
ArrayList alItems = new ArrayList();
foreach(ListItem li in listbboxItems.Items)
{
if(li.Selected == true)
alItems.Add (li.Value);
}
Questions...
1. How do I define the SqlDbType for an array and assign
aiItems to it?
ie...Item_Command.Parameters.Add("@item",
SqlDbType.VarChar, 250).Value = aiItems.ToString();
note: I am using "VarChar, 250" only to clarify my
question.
2. How do I define @items in SQL so that the following
would result
SELECT * FROM tbl WHERE tbl.items IN @item
***or/same as***
SELECT * FROM tbl WHERE tbl.items IN ('AR', 'BC', 'mBR')
Thanks,
Koy