Acessing dataset info

xpertwinner

Member
Joined
Dec 26, 2008
Messages
24
Programming Experience
Beginner
Is it possible to access the dataset information without actually creating a datagridview associated to that table?

I have a dataset with various tables, but i only want to show some tables based on SQL. However, i need to access other tables in dataset.

If I try to acess the dataset as in Dataset.Table.Rows.... i get the message "reference to non-shared member requires an object reference". However, since it is created in a Form, if I type Form.Dataset.Rows... I don't get any error, but the tables which aren't associated to any datagridview in that form return rowcount=0.

Thanks in advance
 
Since you have already binded one table to a grid an instance of the typed dataset is also already added to the form, for example 'someDataset', as you can see in the components area below the form. Some code was also added in forms Load event, something like this:
VB.NET:
Me.someTableAdapter.Fill(Me.someDataSet.Table1)
You can add more code like this to use the related (or same) adapter to fill other tables likewise. The adapters Fill methods is the one generated by the queries you make in dataset designer.
 

Latest posts

Back
Top