1
我想過濾一個Datatable,它的工作原理,但如果我搜索DateTime我得到一個錯誤。如何使用DateTime列過濾DataTable?
這是我的代碼。我做了什麼錯事?
DataTable tb = DataBaseManager.GetRadiusDataTable(radiusconnectionstring, "marksullivan");
DataRow[] filteredRows = tb.Select("AcctStartTime LIKE '%" + searchstring + "%' OR AcctStopTime LIKE '%" + searchstring + "%' OR FramedIPAddress LIKE '%" + searchstring + "%'");
tb = filteredRows.CopyToDataTable();
this.ListView.DataSource = tb;
this.ListView.DataBind();
AcctStartTime:日期時間 AcctStopTime:日期時間 FramedIPAddress:VARCHAR
The error: The Operation 'Like' could not to System.DateTime and System.String execute.
我怎樣才能做到這一點?
嘗試將日期和時間轉換爲字符串時,當你從數據庫獲取數據的時間.... –
爲什麼我們使用的是相同的'SearchString'所有? – Kiran1016
我使用一個mysql適配器 – Tarasov