Results 1 to 2 of 2

Thread: [2.0] Loop Dataset

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2006
    Posts
    719

    [2.0] Loop Dataset

    kindly help me how to loop .net dataset?

    Code:
      Table1.First;
      while not Table1.EOF do begin
        ListBox1.Items.Add(Table1['NAME']);
        Table1.Next;
      end;

    [Title added—please give your threads a title. — Mod]
    Last edited by penagate; Jul 27th, 2007 at 11:21 AM.

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [2.0]

    This code will display every value in every row of every table in your DataSet. Adapt it to get only the bits you need:
    Code:
    foreach (DataTable table in myDataSet)
    {
        foreach (DataRow row in table)
        {
            foreach (DataColumn column in table)
            {
                MessageBox.Show(row(column.ColumnName).ToString());
            }
        }
    }
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width