on 2020 Feb 10 8:28 AM
I have a column in the Database with the following precision: Numeric (40,20) but When I try to read it it's raising me:
iAnywhere.Data.SQLAnywhere.SAException: 'Invalid data conversion' Probably it happens due to in the DataColumn the column precision is not so big. When I loading the data into my object, I declared this property as decimal, like the following:
public decimal? BigNumericColumn{ get; set; } In the loading data processing I'm doing the following.
DataTable schemaTable = dataReader.GetSchemaTable(); DataTable resultTable = new DataTable(typeof(T).Name);
foreach (DataRow dataRow in schemaTable.Rows) { DataColumn dataColumn = new DataColumn(); dataColumn.ColumnName = dataRow["ColumnName"].ToString();
if (lstColumnsToFilter.Contains(dataColumn.ColumnName) && filterEnabled) { lstIndexColumnToFilter.Add(countColumns); }
dataColumn.DataType = Type.GetType(dataRow["DataType"].ToString()); dataColumn.ReadOnly = (bool)dataRow["IsReadOnly"]; dataColumn.AutoIncrement = (bool)dataRow["IsAutoIncrement"]; dataColumn.AllowDBNull = true; resultTable.Columns.Add(dataColumn);
} Do you know how could I fix it?
This is the complete error message:
at iAnywhere.Data.SQLAnywhere.SAException.CheckException(Int32 idEx) at iAnywhere.Data.SQLAnywhere.SADataReader.Read() at RiskAlm_DataExtraction.DataModels.IQ_Queries.GetDataTableFromDR[T](IDataReader dataReader, String path, List1 lstColumnsToFilter, String _sourceConnString) in D:\\C#_RiskAlm_Prototypes\\cabralf\\RiskAlm_DataExtraction\\RiskAlm_DataExtraction\\DataModels\\IQ_Queries.cs:line 277 at RiskAlm_DataExtraction.DataModels.IQ_Queries.<>c__DisplayClass5_0
1.b__0(ListFilter filterValue) in D:\\C#_RiskAlm_Prototypes\\cabralf\\RiskAlm_DataExtraction\\RiskAlm_DataExtraction\\DataModels\\IQ_Queries.cs:line 215 at System.Linq.Parallel.ForAllOperator1.ForAllEnumerator
1.MoveNext(TInput& currentElement, Int32& currentKey) at System.Linq.Parallel.ForAllSpoolingTask`2.SpoolingWork() at System.Linq.Parallel.SpoolingTaskBase.Work()
Error 103 Message "Invalid data conversion" string
Request clarification before answering.
User | Count |
---|---|
74 | |
30 | |
9 | |
7 | |
7 | |
6 | |
6 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.