我試圖篩選基於兩個不同的列數據視圖時:開始時間(日期時間)和結束時間(日期時間)...VB.NET錯誤:「缺少操作數」使用的RowFilter命令
代碼:
Dim dvLosses As New DataView(dsLossData.Tables("AllData").DefaultView.ToTable(True, New String(){"ID", "Name", "StartTime", "EndTime", "Loss"}), "", "StartTime desc", DataViewRowState.CurrentRows)
dvLosses.RowFilter = "Where StartTime > '" + hfFrom.Value + "' and EndTime < '" + hfTo.Value + "'"
Error: Exception details: Syntax error: Missing operand after 'StartTime' operator. at System.Data.ExpressionParser.Parse() at System.Data.DataExpression..ctor(DataTable table, String expression, Type type) at System.Data.DataView.set_RowFilter(String value)
刪除WHERE文本。這是隱含在RowFilter的概念 – Steve
@Steve yup就是這樣......謝謝! – Dplusa25