DbDataRecord Cast Error!

A

Adam J Knight

Hi all,

I am gettting the following error with this line of code:
DbDataRecord test = (DbDataRecord)e.Item.DataItem;

System.InvalidCastException: Specified cast is not valid.

It is happening during a datagrid item bound event.

The datagrids datasource consists of a DataView.

Any thoughts?


Cheers,
Adam
 
K

Karl Seguin [MVP]

cast it to a DataRowView. DataSets, DataTables and DataViews all have their
underlying bound datatype as a dAtaRowView.

Karl
 
K

Karl Seguin [MVP]

Also, you could have found out the actual type by either debugging our
tracing out DataItem.

karl
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top