0

我正在尝试使用 SQL Server 2008 数据库将网格视图绑定到 ASP.NET 中的详细信息视图。当我尝试绑定详细信息视图时,我收到以下错误消息:

该字符串未被识别为有效的日期时间。从索引 0 开始有一个未知单词。

代码:

protected void gvstudentworkshop_SelectedIndexChanged(object sender, EventArgs e)
{
        this.dvuserworkshop.Visible = true;
        this.dvuserworkshop.DataBind();
        this.UpdatePanel1.Update();
        this.Modalenroll.Show();
}

这是我正在使用的查询:

SelectCommand="
SELECT * FROM [tblUserWorkshop] 
WHERE (([WorkshopName] = @WorkshopName) 
AND ([WorkshopLocation] = @WorkshopLocation) 
AND ([UserID] = @UserID) 
AND ([WorkshopDate] = @WorkshopDate))" 

UpdateCommand="
UPDATE [tblUserWorkshop] 
SET [UserWorkshopPaymentStaus] = @UserWorkshopPaymentStaus, 
[ReferralSource] = @ReferralSource, 
[UserWorkshopState] = @UserWorkshopState, 
[UserLastName] = @UserLastName, 
[UserFirstname] = @UserFirstname, 
[UserMiddleInitial] = @UserMiddleInitial 
WHERE [WorkshopName] = @original_WorkshopName 
AND [WorkshopDate] = @original_WorkshopDate 
AND [WorkshopLocation] = @original_WorkshopLocation 
AND [UserID] = @original_UserID 
AND (([UserWorkshopPaymentStaus] = @original_UserWorkshopPaymentStaus) 
OR ([UserWorkshopPaymentStaus] IS NULL 
AND @original_UserWorkshopPaymentStaus IS NULL)) 
AND (([ReferralSource] = @original_ReferralSource) 
OR ([ReferralSource] IS NULL 
AND @original_ReferralSource IS NULL)) 
AND (([UserWorkshopState] = @original_UserWorkshopState) 
OR ([UserWorkshopState] IS NULL 
AND @original_UserWorkshopState IS NULL)) 
AND (([UserLastName] = @original_UserLastName) 
OR ([UserLastName] IS NULL AND @original_UserLastName IS NULL)) 
AND (([UserFirstname] = @original_UserFirstname) 
OR ([UserFirstname] IS NULL 
AND @original_UserFirstname IS NULL)) 
AND (([UserMiddleInitial] = @original_UserMiddleInitial) 
OR ([UserMiddleInitial] IS NULL
 AND @original_UserMiddleInitial IS NULL))">

我收到此错误消息是否有可能的原因?

4

1 回答 1

0

绑定函数似乎无法将返回值从数据库转换为日期时间对象。你能找出日期时间的返回值,看看它是否可以转换为有效的日期时间吗?

于 2013-04-22T00:45:48.307 回答