I am trying to pass a bit value only if needed (is checked).
How do I do this correctly? I am not getting a change in my dataset. SQL Server 2008.
if (chkExpired.Checked)
CmdGetDetails.Parameters.Add(new SqlParameter("@isExpired", 1));
bit
refers to Boolean
so you would pass a boolean value in parameter's value
Ex :
CmdGetDetails.Parameters.AddWithValue("isExpired", chkExpired.Checked);
There is no addtional need to use a if block.