Are you inserting into database, ot selecting from it? Regarding on your code (when using ExecuteNonQuery() method) you are inserting.
You have to change your format that will suit to the database` dateTime column format. You can do it like:
DateTime date = dateTimePicker1.Value.Date;
string sDate = date.ToString("dd-MM-yy", System.Globalization.CultureInfo.InvariantCulture);
DateTime dateInsert = Convert.ToDateTime(sDate); //use this dateInsert as parameter to insert into DB.
Mitja
Mitja Bonca
Nearly a Posting Maven
2,485 posts since May 2009
Reputation Points: 641
Solved Threads: 474
Anytime. Just dont forget to close the thread and mark is as answered.
best regards,
Mitja
Mitja Bonca
Nearly a Posting Maven
2,485 posts since May 2009
Reputation Points: 641
Solved Threads: 474