Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

storing tableadapter rows to an array

Posted on 2007-11-29
4
Medium Priority
?
815 Views
Last Modified: 2008-02-01
I need to loop through the table adapter and store it as an array.

Should I loop like this?

And if so, How do I put that in an array and define the array?

    For Each NumMembersRow As IDataSet.NumMembersRow In members
        strNumMembers = FormatNumber(NumMembersRow.m_id, 0)
    Next

If there is a better way, please tell me.

thanks.
0
Comment
Question by:Starr Duskk
  • 3
4 Comments
 
LVL 29

Assisted Solution

by:QPR
QPR earned 2000 total points
ID: 20378243
if you put the data into a dataread then you can use this...

 If reader.HasRows Then
                For Each rec As System.Data.Common.DbDataRecord In reader
                    arr.Add(rec)
                Next
            End If

0
 
LVL 29

Assisted Solution

by:QPR
QPR earned 2000 total points
ID: 20378281
Dim arr As New ArrayList
0
 
LVL 2

Author Comment

by:Starr Duskk
ID: 20378357
Can I create a DataSet that puts data into a datareader?

I can ask a new question how to do that, but if I can't do that, then I need an answer that uses my dataset.
0
 
LVL 29

Accepted Solution

by:
QPR earned 2000 total points
ID: 20378417
http://samples.gotdotnet.com/quickstart/howto/doc/adoplus/GetDataFromDB.aspx
shows you how to create the dataset and how to loop through row by row.
Instead of doing the console.write as this article does... add to your array instead.
No need for a datareader now
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
Screencast - Getting to Know the Pipeline
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question