?
Solved

Returning One row from TableAdapter

Posted on 2007-11-28
2
Medium Priority
?
1,158 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 8

Accepted Solution

by:
Thejaka earned 2000 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

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…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

649 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