Is this OleDbDataAdapter bug

Posted by ???? on Stack Overflow See other posts from Stack Overflow or by ????
Published on 2013-11-01T15:28:03Z Indexed on 2013/11/01 15:54 UTC
Read the original article Hit count: 334

Filed under:
|
|

It doesn't look to me OleDbDataAdapter should throw an exception on trying to fill DataSet for a db table column of type decimal(28,3). The message is "The numerical value is too large to fit into a 96 bit decimal". Could you just check this, I have no significant experience with ADO.NET and OLE DB components?

The VB.NET code we have in the application is this:

Dim dbDataSet As New DataSet
Dim dbDataAdapter As OleDbDataAdapter
Dim dbCommand As OleDbCommand
Dim conn As OleDbConnection
Dim connectionString As String

'parts where connectionString is set 

conn = New OleDbConnection(connectionString)

'part where sqlQuery is set but it ends up being "SELECT Price As 'Price' From PricebookView" - Price is of type decimal(28,3)

dbCommand = New OleDbCommand(sqlQuery, conn)
dbCommand.CommandTimeout = cmdTimeout
dbDataAdapter = New OleDbDataAdapter(dbCommand)
dbDataAdapter.Fill(dbDataSet)

The last line is where the exception is thrown and the top of the stack trace is:

at System.Data.ProviderBase.DbBuffer.ReadNumeric(Int32 offset)     
at System.Data.OleDb.ColumnBinding.Value_NUMERIC()     
at System.Data.OleDb.ColumnBinding.Value()     
at System.Data.OleDb.OleDbDataReader.GetValues(Object[] values)     
at System.Data.ProviderBase.DataReaderContainer.CommonLanguageSubsetDataReader.GetValues(Object[] values)     
at System.Data.ProviderBase.SchemaMapping.LoadDataRow()     
at System.Data.Common.DataAdapter.FillLoadDataRow(SchemaMapping mapping)     
at System.Data.Common.DataAdapter.FillFromReader(DataSet dataset, DataTable datatable, String srcTable, DataReaderContainer dataReader, Int32 startRecord, Int32 maxRecords, DataColumn parentChapterColumn, Object parentChapterValue)     
at System.Data.Common.DataAdapter.Fill(DataSet dataSet, String srcTable, IDataReader dataReader, Int32 startRecord, Int32 maxRecords)     
at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)     
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)     
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet)     
...

I am not sure why does it try to set the value to Int32.

Thank you for the time !

© Stack Overflow or respective owner

Related posts about vb.net

Related posts about ADO.NET