从字符串转换日期和/或时间时,错误转换失败 [英] error conversion failed when converting date and/or time from character string
本文介绍了从字符串转换日期和/或时间时,错误转换失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有这个gridview,并且我使用sqldatasource
这是我的选择命令
i have this gridview, and i use sqldatasource
this is my select command
SELECT Date.dateAvailable FROM LessonDate INNER JOIN Date ON LessonDate.dateID = Date.dateID WHERE (LessonDate.lessonID = @lessonID)
但是,当我想更新dateAvailable列时
however when i want to update the dateAvailable column
UPDATE Date
SET dateAvailable = @dateAvailable
FROM Date INNER JOIN
LessonDate ON Date.dateID = LessonDate.dateID
WHERE (LesssonDate.dateID = @LessonDateID)
但是,当我单击执行查询时,当从字符串转换日期和/或时间时,它给我错误转换失败
那么怎么了?
however it when i click on excute query it give me error conversion failed when converting date and/or time from character string
so what wrong?
推荐答案
@LessonDateID
可能是varchar
类型.
尝试使用CAST
或CONVERT
并转换 [ ^ ]从varchar
到DateTime
.
@LessonDateID
is probably ofvarchar
type.
Try usingCAST
orCONVERT
and convert[^] thisvarchar
toDateTime
.
这篇关于从字符串转换日期和/或时间时,错误转换失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文