【发布时间】:2014-02-21 08:53:18
【问题描述】:
我想在后面的代码中设置以下 linqdatasource where 子句。
<asp:LinqDataSource ID="lds" runat="server" ContextTypeName="dcDataContext"
TableName="vStaff_Currents" OrderBy="Department,DisplayName" >
</asp:LinqDataSource>
在后面的代码中:
Dim filterString As String = ""
Dim AtDate As Date = Nothing
AtDate = Request("PeriodEnd").ToDate
filterString = "xxxxxxxxxxx"
filterString = filterString & "xxxxxxxxxxx"
lds.Where = filterString
我想在查询字符串 [Request("PeriodEnd")] 的 where 子句中插入日期时间条件
我尝试了不同的命令,但它返回错误
选项 1:
filterString = filterString & " and (RenumerationDate <= DateTime.Parse(" & AtDate & "))"
错误:
“日期时间”类型中不存在适用的方法“解析”
选项 2:
filterString = filterString & " and (RenumerationDate <= " & AtDate.ToString("dd-mm-yyyy") & " )"
错误:
运算符 '
如何在后面的代码中添加 where 子句?谢谢
【问题讨论】:
-
您的“RenumerationDate”数据类型是什么?
-
你好,数据类型是“日期时间”
标签: asp.net vb.net linq datetime where-clause