Getting Data from a DataSet  
Author Message
pieta4mi





PostPosted: Tue Mar 21 15:43:21 CST 2006 Top

ADO >> Getting Data from a DataSet 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

DotNet132  
 
 
William





PostPosted: Tue Mar 21 15:43:21 CST 2006 Top

ADO >> Getting Data from a DataSet 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
"glenn" <EMail@HideDomain.com> wrote in message
news:EMail@HideDomain.com...
> 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


 
 
glenn





PostPosted: Tue Mar 21 16:26:30 CST 2006 Top

ADO >> Getting Data from a DataSet and what book name might that be?

"William (Bill) Vaughn" wrote:

> 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
> "glenn" <EMail@HideDomain.com> wrote in message
> news:EMail@HideDomain.com...
> > 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
>
>
>
 
 
William





PostPosted: Thu Mar 23 15:28:57 CST 2006 Top

ADO >> Getting Data from a DataSet 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.
__________________________________

"glenn" <EMail@HideDomain.com> wrote in message
news:EMail@HideDomain.com...
> and what book name might that be?
>
> "William (Bill) Vaughn" wrote:
>
>> 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
>> "glenn" <EMail@HideDomain.com> wrote in message
>> news:EMail@HideDomain.com...
>> > 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
>>
>>
>>