Invalid Cast Exception when trying to set DataGrid DataSource = IDataReader object (why??...)
Posted on 2007-11-21
Here is my code which calls a function that returns an IDataRreader object (I have verified that the IDataReader is populated with the correct data set I wish to use as my DataSource):
dgMyGrid.DataSource = GetIDataReaderDataSource()
dgBillTo.DataBind() 'fails on this line with "Invalid Cast Exception"
Catch ex As Exception
Can someone tell me why this is occuring and what I can do alternatively to make it work?
Thanks much in advance.