I am inserting record into datatbase, when i insert record into datebase, then Message is coming of "Record Not Save" but data get inserted into database.
below is query
protected void btn_sav_Click(object sender, EventArgs e)
{
if (txtcitemnam.Text == "")
{
Response.Write("<script>alert('Please Input Name')</script>");
}
else if (DDLICus.Text == "0")
{
Response.Write("<script>alert('Please Select Customer Name')</script>");
}
else if (DDLCMI.SelectedValue == "0")
{
Response.Write("<script>alert('Please Select Master Item Name')</script>");
}
else
{
SqlCommand cmd = new SqlCommand("[Sp_insertCustomeritem]", con);
cmd.CommandType = CommandType.StoredProcedure;
{
// cmd.Parameters.AddWithValue("@RollNo", TextBox4.Text.Trim());
cmd.Parameters.AddWithValue("@CIName", txtcitemnam.Text.Trim());
cmd.Parameters.AddWithValue("@CustomerID", DDLICus.SelectedValue);
cmd.Parameters.AddWithValue("@Codeitem", DDLCMI.SelectedValue);
cmd.Parameters.AddWithValue("@Date", DateTime.Now);
con.Open();
int i = cmd.ExecuteNonQuery();
if (i > 0)
{
Response.Write("<script>alert('Record save successuly')</script>");
}
else
{
Response.Write("<script>alert('Record Not save')</script>");
}
con.Close();
}
}
}