hi i need help
0 pts.
0
Q:
hi i need help
in c#.net we are taking datetime from datetimepicker we are storing datetime into sqlserverdatabase.
in sqlserver we are taking datetime datatype.

we write code like this:
Datetime dt=DateTimePicker1.value;
cmd=new sqlcommand("insert into values(date) tablename('"+dt+"')",con);
cmd.excutenonqury();

we are seleted date datetimepicker as 19/12/2006
after excuting this one we are getting error like this:
conversion of char data type to datetime data type resulted in an out of range datetime value
ASKED: Dec 19 2006  4:33 AM GMT
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
0
0 pts.
0
A:
 RATE THIS ANSWER
0
Click to Vote:
  •   0
  •  0
  • AddThis Social Bookmark Button
MSSQL does not recognize day/month/year as a valid date format. It can be reversed to year/month/day or use month/day/year.
Last Answered: Dec 19 2006  8:53 AM GMT by MooseDrool   0 pts.
0
0
Discuss This Answer:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _



_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

BillElPaso   0 pts.  |   Dec 19 2006  10:54AM GMT

you are using European style dates, DD/MM/YYYY and SQL Servert is expecting American style dates MM/DD/YYYY. change the code that looks like (’”+dt+”‘) to look like (’”+Format(dt,”MM/DD/YYYY”)+”‘) should do the trick.

 
0