Solved

Returning One row from TableAdapter

Posted on 2007-11-28
2
1,153 Views
Last Modified: 2009-07-29
I have created a table adapter that returns one row (selec top 1 ....)

In my Page_Load function, I want to take that value and put it in a label.

        Dim IAdapter As New IDataSetTableAdapters.Member1TableAdapter()
        Dim members As IDataSet.Member1DataTable

        members = IAdapter.GetNumberMembers

        For Each member1Row As IDataSet.Member1Row In members
            LabelNumMembers.Text = FormatNumber(member1Row.m_id, 0)
        Next

    End Sub

How do I convert the "For Each" properly for just one row?

And am I doing the above correctly? It works, so I know it ain't broke. But maybe it's misguided and could be improved?

thanks.
0
Comment
Question by:Starr Duskk
2 Comments
 
LVL 8

Accepted Solution

by:
Thejaka earned 500 total points
ID: 20370895
There's really nothing wrong in using For Each, but if you insist...

If members.Rows.Count > 0
  LabelNumMembers.Text = FormatNumber(members(0).m_id, 0)
End If

Open in new window

0
 
LVL 2

Author Comment

by:Starr Duskk
ID: 20373197
thanks!!! yay! shiney!

0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

726 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