Numeric Precision in Data Column

  • Thread starter Thread starter FcabralJ
  • Start date Start date
F

FcabralJ

Guest
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?

Continue reading...
 
Back
Top