我插入数据库时无法识别日期时间 [英] can not recognize the datetime when i insert into DB
本文介绍了我插入数据库时无法识别日期时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨.
我使用jquery制作了日历,并将其放入表单中,因此当用户单击文本框时,日历就会出现,并可以选择他(她)的生日,
但我的问题是:
有时当我这样做并想插入数据库时,会发生此异常:
字符串未被识别为有效的DateTime.
同时,这种异常会在一段时间内发生.我不知道如何防止它发生?
Hi.
i have made a calender with jquery and put it in my form so when user click on textbox the calendar appeares and can choose his (her) birthdate,
but my problem is :
sometimes when i do this and want to insert into the database this exception occures :
String was not recognized as a valid DateTime.
meanwhile this exception in some part of time happens. i don''t know how can i prevent it happens?
推荐答案
不要将其作为字符串传递.
而是通过参数化查询将其作为DateTime变量传递.
我无法给您代码,因为我不知道您当前正在使用什么代码...
Don''t pass it as a string.
Pass it as a DateTime variable instead, via a Parametrised query.
I can''t give you code, as I have no idea what code you are currently using...
这篇关于我插入数据库时无法识别日期时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文