i have a store prog where getting the department where being selected in the group of check box. when i pass one value it work but when i pass more than 2 dept it is not workiing
in store prog
CREATE PROCEDURE [dbo].[REPORT]
@dept nvarchar(max)=null
AS
set @dept=left(@dept,len(@dept)-1)
select * from department where deptid in(@dept)
in my code behind
string dept = "";
foreach (ListItem item in CheckBoxList1.Items)
{
if(item.Selected)
{
dept+="'"+item.Value.ToString()+"',";
}
}
...
...
...
cmd.Parameters.AddWithValue("@dept", dept);
using (SqlDataAdapter sda = new SqlDataAdapter(cmd))
{
sda.Fill(dt);
gvdata.datasource=dt;
gvdata.bind();
}