suhel jamadar

suhel jamadar

  • NA
  • 133
  • 12.1k

ExecuteNon query error at date time

Oct 14 2020 2:12 AM
SqlCommand cmd = new SqlCommand("INSERT INTO Monitor VALUES(@LCDSrNo, @ProductName, @LCDProductNo, @Date)", con);
cmd.CommandType = CommandType.Text;
cmd.Parameters.AddWithValue("@LCDSrNo", textBox2.Text);
cmd.Parameters.AddWithValue("@ProductName", textBox3.Text);
cmd.Parameters.AddWithValue("@LCDProductNo", textBox4.Text);
cmd.Parameters.AddWithValue("@Date", dateTimePicker1);
con.Open();
cmd.ExecuteNonQuery();
con.Close();

Answers (11)