You will need to format your date with sql default format (YYYY-MM-DD).
/// <summary>
/// ToSqlDate
///
/// converts datetime object to datetime string
/// with format YYYY-MM-DD HH:MM:SS
/// </summary>
/// <param name="dt">datetime object</param>
/// <returns>string with YYYY-MM-DD HH:MM:SS format</returns>
public string ToSqlDate(DateTime dt)
{
return string.Format
(
"{0}-{1}-{2} {3}:{4}:{5}",
dt.Year.ToString("0000"),
dt.Month.ToString("00"),
dt.Day.ToString("00"),
dt.Hour.ToString("00"),
dt.Minute.ToString("00"),
dt.Second.ToString("00")
);
}
Then you call it like this:
String q = "insert into Development_Detal values('" + Ename.Text + "','" + UserPass.Text + "','" + EmpID.Text + "','" + address.Text + "','" + emaill.Text + "','"+ToSqlDate(dateTimePicker1.Value)+"', '" + mobNo.Text + "','" + city.Text + "' )";