Getting Data from a DataSet

G

Guest

Hello,

I have a DataSet that was returned from a QueryMethod ( ).

Using the following code, I drilled down to the column level but am unsure
how to get at the data:

Dim ds As System.Data.DataSet
Dim dt As System.Data.DataTable
Dim dr As System.Data.DataRow
Dim dc As System.Data.DataColumn

ds = QueryMethod()

For Each dt In ds.Tables
For Each dr In dt.Rows
For Each dc In dt.Columns
if dr(dc) = "owner" then

' GET DATA VALUE IN THE TABLE IN THE ROW OF THE COLUMN

end if
Next dc
Next dr
Next dt

Thanks for any help.
glenn
 
W

William \(Bill\) Vaughn

Ah Glenn, there are million examples of this on the web and in any (growing)
number of books on ADO.NET
once you have the ds:
dim x as Object
x = ds.Tables("Mytable").Rows(0).Item("MyColumnName")
While this will do the trick, it's not (at all) efficient as many have
pointed out. I suggest doing some reading. My book might be a good place to
start...

--
William (Bill) Vaughn
President and Founder Beta V Corporation
Redmond, WA
(425) 556-9205
Microsoft MVP, Author, Mentor
Microsoft MVP
 
G

Guest

and what book name might that be?

William (Bill) Vaughn said:
Ah Glenn, there are million examples of this on the web and in any (growing)
number of books on ADO.NET
once you have the ds:
dim x as Object
x = ds.Tables("Mytable").Rows(0).Item("MyColumnName")
While this will do the trick, it's not (at all) efficient as many have
pointed out. I suggest doing some reading. My book might be a good place to
start...

--
William (Bill) Vaughn
President and Founder Beta V Corporation
Redmond, WA
(425) 556-9205
Microsoft MVP, Author, Mentor
Microsoft MVP
 
W

William \(Bill\) Vaughn

See www.betav.com for a complete list. I was referring to either the latest
Hitchhiker's Guide or the "ADO and ADO.NET Examples..." titles. I'm working
on a new version of the HHG for the 2005 products. It should be ready in a
few months.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 

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