Click here to Skip to main content
15,886,799 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I have figured out how to do pretty much everything with DataSets in VB8. I just can't for the life of me figure out how to return the data contained in specified table, row and column. I’m sure the answer is really simple.

Please Help

Marco
Posted

1 solution

Yes it is simple.

As you say you have pretty much figured out *everything* about DataSet, then Datatable row/column access would be easy for you.
As:
Dataset is a collection of tables (one or more).

C#:
myDataSet.Tables[0].Rows //0 for first table.
myDataSet.Tables[0].Columns //0 for first table

VB:
myDataSet.Tables(0).Rows
myDataSet.Tables(0).Columns

This should get you going.

Read all about the Dataset and tables in VB here: The Tables of a Data Set[^]
 
Share this answer
 
v2
Comments
[no name] 15-Jul-10 3:11am    
Hi,

Thanks for the Quick response.

I used:
AccommodationDataSet.Tables[0].rows
AccommodationDataSet.Tables[0].columns

on "[0]" I get "Identifier Expected"
and there is no Rows or Columns properties available under the property Tables.

I'm using VB8, are you using C?
Sandeep Mewara 15-Jul-10 3:19am    
Updated answer with VB sample and a link that would help you in learning all about datatables n dataset.
[no name] 15-Jul-10 3:33am    
Reason for my vote of 5
Quick Response, Perfect Answer!
[no name] 15-Jul-10 3:37am    
Thanks!

I did this:
Label2.Text = AccommodationDataSet.Tables(0).Rows(1).Item("AFloor")

Got it to work, and it was really simple! I really deserve a boot to the head!

Thanks Again
Sandeep Mewara 15-Jul-10 3:38am    
:) no issues. It happens.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900