I have Date field in my mysql table. I want to insert the date through my Date picker control of windows forms c#. How ?
when i tried using below, i am getting error.
Code :
DB.Insert_Orders(Convert.ToInt32(txtA.Text), Convert.ToInt32(txtB.Text), Convert.ToInt32(txtC.Text), DTP_date.Value.ToString("yyyy/MM/dd"));
Error :
{MySql.Data.MySqlClient.MySqlException: Incorrect datetime value: '15' for column 'Date开发者_如何学编程' at row
Try
DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
Or
DateTime.Now.ToString("yyyyMMddHHmmss");
You need to convert the value of datetime picker in to type DateTime. Then pass the value.
精彩评论