tags:

views:

34

answers:

2

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 
A: 

Try

DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");

Or

DateTime.Now.ToString("yyyyMMddHHmmss");
Kru
A: 

You need to convert the value of datetime picker in to type DateTime. Then pass the value.

gsoni