Results 1 to 5 of 5

Thread: Parse dataset: resolved

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Oct 2002
    Posts
    67

    Parse dataset: resolved

    Hey guys, I'm hoping someone could help me parse a dataset.. Below is the
    non-syntanically corrct way of doing it, I'm hoping someone could translate
    it from english to vb.net

    With each row in dataset do
    with each column in dataset do
    writeline("this is the data from this cell")
    loop
    loop


    so it parses each cell, so if i have a dataset like this

    1 2 3
    4 5 6
    7 8 9

    it would parse, and pull data from 1, then 2, then 3, then 4, yada yada....

    thanks!
    Last edited by Iamthewalrus15; May 21st, 2003 at 05:36 PM.

  2. #2
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Just do a couple nested for..each loops for the rows and columns collection of the dataset.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Oct 2002
    Posts
    67
    hehe yes,, thats the code i wrote in english,, I'm trying to figure out how to write that in vb.net

  4. #4
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    VB Code:
    1. 'Go through all the columns and rows.
    2.         'Putting the results in a string.
    3.         Dim myString As String
    4.         Dim dr1 As DataRow
    5.         For Each dr1 In MyDataSet.Tables(0).Rows
    6.             For i = 0 To 2 ' Column amount - 1 (I am using a column count of 3, but you can change this to the amount of your columns.
    7.                 myString += dr1(i) + " - "
    8.             Next
    9.         Next
    10.  
    11.         MessageBox.Show(myString)

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Oct 2002
    Posts
    67
    Beautiful,, tested, works like a charm

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