davearia Posted October 15, 2008 Posted October 15, 2008 Hi, At work we have a data access layer that has been developed by one of developers. Things is it works well enough with the exception of one thing. There is a class in this datalayer that subclasses System.Data.Datatable. So for example if I populated a System.Data.Dataset and then tried to put the first table of this dataset into this class like so: Dim dt as new myDatable dt = ds.Tables(0) I get an InvalidCastException. I have created the most basic of classes for myDatable. Public Class myDatable: Inherits System.Data.DataTable End Class Is there as interface missing or something? Quote
Administrators PlausiblyDamp Posted October 15, 2008 Administrators Posted October 15, 2008 Is ds.Tables(0) a DataTable or a myDataTable? If it is a plain DataTable then you cannot cast it to a myDataTable. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
davearia Posted October 15, 2008 Author Posted October 15, 2008 Ds.Tables(0) is a datatable. What your saying is what I expected. Thanks for confirming this, I just wanted to know if the table in the dataset could be cast to a subclass of datatable. Just so long as I know. Cheers, Dave. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.