我有日期字符串:字符串转换为日期时间以特定格式
Fri Oct 25 22:52:21 2013
我想把它转换成日期时间格式,同时把它发送到数据库。
我试着查询为:
insert into
DeccoRaw values
('A04','005629','ARROW STEPLADDER 3TREAD 13013',
19.89,1,35.8,'NETT',19.89,'5010845130133',
cast('Fri Oct 25 22:52:21 2013' as DateTime),
20,'LADDERS','D19206','A','N','13013',29,'','','','','')
我使用C#.NET
它给我的错误:
Msg 241, Level 16, State 1, Line 1
Conversion failed when converting date and/or time from character string.
当我把它转换在C#中为: DateTime.Parse('Fri Oct 25 22:52:21 2013')
错误:
string was not recognized as valid datetime
为什么使用未将其转换DateTime方法,而不是在查询中这样做? – Max
@MaxMommersteeg它给了我错误:字符串未被识别为有效的日期时间 –