Jagjit Saini

Jagjit Saini

  • NA
  • 196
  • 37.7k

Error - Conversion failed when converting date and/or time

Nov 13 2018 9:43 AM
Hi
 


SqlCommand cmd = new SqlCommand("INSERT INTO [Period] (Date1,Date2) VALUES('" + @Date11 + "','" + @Date12 + "')", con);

cmd.Parameters.AddWithValue("@Date11", txt_Date11.Text.Trim());
cmd.Parameters.AddWithValue("@Date12", txt_Date12.Text.Trim());

Thanks

 

Answers (1)