我想選擇一個數據表對象。當我的表達式值是82.5(double)時,代碼拋出異常。DataTable選擇:double值無法過濾
_dataSet.Tables[2].Select("ProfitShareRatio = " + Convert.ToDouble(_listrow[m]["ProfitShareRatio"]));
P.S:ProfitShareRatio
值是在雙_dataSet.Tables[2]
ERROR:
Syntax error in the expression.
at System.Data.ExpressionParser.Parse() at System.Data.DataExpression..ctor(DataTable table, String expression, Type type) at System.Data.Select..ctor(DataTable table, String filterExpression, String sort, DataViewRowState recordStates) at System.Data.DataTable.Select(String filterExpression)
編輯2: 相同出錯當我使用十進制。
_dataSet.Tables[2].Select("ProfitShareRatio = " + Convert.ToDecimal(_listrow[m]["ProfitShareRatio"]));
P.S 2:問題是Convert.ToDecimal(_listrow[m]["ProfitShareRatio"])
是逗號像82,50 我需要用點狀82.50
出於興趣,_dataSet.Tables [2] .Select(「ProfitShareRatio = 82.5」)工作嗎?你確定_dataSet.Tables [2]中ProfitShareRation的數據類型是雙倍的嗎?那麼_dataSet.Tables [2] .Columns [「ProfitShareRation」] .DataType給你帶來了什麼? – dash
@maycil能否向我們解釋_listrow [m] [「ProfitShareRatio」]? – HichemSeeSharp
@dash _dataSet.Tables [2] .Select(「ProfitShareRatio = 82.5」)正在工作。 _dataSet.Tables [2] [「ProfitShareRatio」]是十進制數。 – maycil