Create Proc TestPro @Parameter Varchar(100) as Declare @QueryStr Varchar(1000) set @QueryStr='Select Col1,Col2,Col3,Col4 from Table where Col1 in('+ @Parameter+ ')' Exec (@QueryStr)
string strPrValue="'ABC/01','ABC/02','ABC/03'"; SqlConnection sconPM = new SqlConnection(Constring); SqlCommand sCmd = new SqlCommand("TestPro", sconPM); SqlDataAdapter DA = new SqlDataAdapter(sCmd); DataSet ds = new DataSet(); sCmd.Parameters.Add("@Parameter", SqlDbType.VarChar).Value = strPrValue; sCmd.CommandType = CommandType.StoredProcedure; DA.Fill(ds);
('+ @Parameter+')';
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)