本文介绍了将日期时间值插入sql的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 你好吗... i我正在尝试执行一个语句,其中我将带有datetime 值的记录插入到sql数据库中。 Dim sqlcmd作为新的SqlCommand sqlcmd.CommandText =" update tbl_event set last_run =''" & nowTime& "'',event_action = 1,event_time =''" &安培; nextPollTime& "''' event_id =" &安培; IntEventID Debug.Print(sqlcmd.CommandText) sqlcmd.Connection = dbConnectionIn sqlcmd.CommandType = CommandType.Text sqlcmd.ExecuteNonQuery() 命令文件等于 event_time =''15/07/2008 13:07:42''where event_id = 1 我收到以下错误.... 将char数据类型转换为日期时间数据类型导致 out-of - 日期时间值。 我正在做什么错了???? 感谢您的帮助 解决方案 howdy... i am trying to execute a statement where i insert a record with datetimevalues into a sql database. Dim sqlcmd As New SqlCommand sqlcmd.CommandText = "update tbl_event set last_run = ''" &nowTime & "'', event_action =1, event_time = ''" & nextPollTime & "'' whereevent_id = " & IntEventIDDebug.Print(sqlcmd.CommandText) sqlcmd.Connection = dbConnectionInsqlcmd.CommandType = CommandType.Textsqlcmd.ExecuteNonQuery() the commandtext equals update tbl_event set last_run = ''15/07/2008 13:07:27'', event_action =1,event_time = ''15/07/2008 13:07:42'' where event_id = 1 I get the following error.... The conversion of a char data type to a datetime data type resulted in anout-of-range datetime value. Whats wrong with what I am doing ???? Thanks for your help 解决方案 这篇关于将日期时间值插入sql的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 10-15 14:36