Solved

Returning One row from TableAdapter

Posted on 2007-11-28
2
1,148 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:BobCSD
2 Comments
 
LVL 8

Accepted Solution

by:
Thejaka earned 500 total points
Comment Utility
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 1

Author Comment

by:BobCSD
Comment Utility
thanks!!! yay! shiney!

0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

743 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now