how to Insert Datetimepicker text in SQL Database as datetime datatype
A:
Parse the text in C#, and insert the parsed DateTime
. Example:
var date = new DateTime(dateTimePickerText);
InsertIntoSqlDatabase(date); // Code for inserting here.
Tomas Lycken
2010-06-30 07:38:32
+2
A:
In order to parse the datetime from datetime picker you can do the following:
string dt = dateTimePicker.Value.ToString("yyyy-mm-dd hh:MM:ss");
And then in order to insert it in your database you can do:
Insert into table (id, mytime)
values("5", CONVERT(datetime, CONVERT( varchar(11), dt, 101))
If you need information on how to access your database you can read the following article in CodeProject
ppolyzos
2010-06-30 08:19:43
thanks for your answer
KARTHIK V
2010-06-30 09:51:22