i am trying to insert null value from textbox into table and data type is int, but error is coming.
Procedure or function 'spInsertbigbale' expects parameter '@BIDR', which was not supplied.
string val1 = !string.IsNullOrEmpty(TextBox1.Text) ? TextBox1.Text : null;
// int val = !int.Parse.IsNullOrEmpty(TextBox2.Text) ? TextBox2.Text : null;
int? val = null;
if (!string.IsNullOrEmpty(TextBox2.Text))
{
val = Convert.ToInt32(TextBox2.Text);
}
con.Open();
SqlCommand cmd = new SqlCommand("spInsertbigbale", con);
cmd.CommandType = CommandType.StoredProcedure;
// cmd.Parameters.AddWithValue("@RollNo", TextBox4.Text.Trim());
cmd.Parameters.AddWithValue("@Codeitem", ddlBbitem.SelectedValue);
cmd.Parameters.AddWithValue("@Bweight", prdbqty.Text.Trim());
cmd.Parameters.AddWithValue("@Bpqty", opbbqty.Text.Trim());
cmd.Parameters.AddWithValue("@CID", DDLBBCID.SelectedValue);
cmd.Parameters.AddWithValue("@SecID", DDLBBsec.SelectedValue);
cmd.Parameters.AddWithValue("@EntryDate", txtbpentrydate.Text);
cmd.Parameters.AddWithValue("@Mno", txtmno.Text.Trim());
cmd.Parameters.AddWithValue("@Ipaddress", lblIP.Text);
cmd.Parameters.AddWithValue("@ETime", DateTime.Now.ToString("hh:mm"));
cmd.Parameters.AddWithValue("@BIDR", val);
cmd.Parameters.AddWithValue("@Trans", val1);