Hello Everybody..
my question is like this. I have one String str which contains multiple customer Id like C00001,C00002,C00003.. seperated by comma.
Now i wants to pass this string str as single parameter to my stored procedure. I tried below code but it doen't works.
can anybody please help me???????
eg
foreach (string s in idlist)
{
str = str +"'"+ s +"'" + ",";
}
str = str.Substring(0, str.Length - 1);
Now i wants to pass this str to my stored procedure as parameter
stored procedure is like this
select * from Customer_Master where CustomerId IN(@CustomerId)
Loading
VasanthPosted Apr 9, 2010, 1:09 AM
//Assign the temp data
Hashtable htTemp = new Hashtable();
htTemp.Add(1, "C00001");
htTemp.Add(2, "C00002");
htTemp.Add(3, "C00003");
//Concat the IDs
string sCustomerIDs = string.Empty;
foreach (string sValue in htTemp.Values)
{
sCustomerIDs = sCustomerIDs + "'" + sValue + "',";
}
//Substring last comma
if (sCustomerIDs.Length > 0)
sCustomerIDs = sCustomerIDs.Substring(0, sCustomerIDs.Length - 1);
//Write the output
Response.Write(sCustomerIDs);
Please mark as answer , if it helps you.
Sam HobbsPosted Apr 8, 2010, 5:21 PM