“Unable to cast object of type 'System.Data.DataTable' to type 'System.Data.IDataReader'” to Strongly Typed DataSet

December 16, 2010 at 11:18 AMFred Mastro

 

Unable to cast object of type 'System.Data.DataTable' to type 'System.Data.IDataReader'

When you try and set a Strongly Typed DataTable to another DataTable.

Use .Merge on your strongly typed dataset to correct this problem.

 

Dim dsCallData As YourStronglyTypedDataSet
Dim dsCallInfoQueriedFromDB As New DataTable

'... code here to populate dsCallInfoQueriedFromDB from database ...

dsCallData.dtCallInfol.Merge(dsCallInfoQueriedFromDB)

Posted in: VB.NET

Tags: