Results 1 to 3 of 3

Thread: reading a dataset

  1. #1

    Thread Starter
    Registered User jkw119's Avatar
    Join Date
    Oct 2001
    Location
    Pittsburgh
    Posts
    256

    reading a dataset

    ok,

    does anyone know how to read a dataset...

    i have an xml file that contains 3 columns of data and the following code that puts it into a datagrid on the form.

    VB Code:
    1. Dim myStream As System.IO.Stream
    2. Dim openFileDialog1 As New OpenFileDialog()
    3.  
    4. openFileDialog1.Title = "Open an XML file to analyze"
    5. openFileDialog1.InitialDirectory = "c:\"
    6. openFileDialog1.Filter = "xml files (*.xml)|*.xml|All files (*.*)|*.*"
    7. openFileDialog1.FilterIndex = 1
    8. openFileDialog1.RestoreDirectory = True
    9.  
    10. If openFileDialog1.ShowDialog() = DialogResult.OK Then
    11. myStream = openFileDialog1.OpenFile()
    12. ProfileName = openFileDialog1.FileName
    13. MsgBox(ProfileName)
    14.  
    15. Dim newDataSet As New DataSet()
    16. newDataSet.ReadXml(ProfileName)
    17. DataGrid1.SetDataBinding(newDataSet, "point")
    18.      If Not (myStream Is Nothing) Then
    19.           myStream.Close()
    20.      End If
    21. End If

    so how do i read each colum in the datagrid into an array

    column1(x), column2(x), column3(x) so i can do some calculations (like multiply each column by 3) then repopulate the dataset...

    i am new to this whole database stuff, i don't even know if i need to read it into an array or what..

    thanks,

    jeff
    Attached Files Attached Files

  2. #2

    Thread Starter
    Registered User jkw119's Avatar
    Join Date
    Oct 2001
    Location
    Pittsburgh
    Posts
    256
    nevermind, i just figured it out, but for anyone elses reference...

    you read a dataset like so...

    first a load an xml file into a dataset
    then i can access the data like this...

    VB Code:
    1. Dim newDataSet As New DataSet()
    2.             newDataSet.ReadXml(ProfileName)
    3.  
    4.             Dim a As Single
    5.             a = newDataSet.Tables(0).Rows(0)(1)
    6.             MsgBox(a)

    this is good stuff...

    Jeff

  3. #3

    Thread Starter
    Registered User jkw119's Avatar
    Join Date
    Oct 2001
    Location
    Pittsburgh
    Posts
    256
    nevermind, i just figured it out, but for anyone else interested...

    you read a dataset like so...

    first a load an xml file into a dataset
    then i can access the data like this...

    VB Code:
    1. Dim newDataSet As New DataSet()
    2.             newDataSet.ReadXml(ProfileName)
    3.  
    4.             Dim a As Single
    5.             a = newDataSet.Tables(0).Rows(0)(1)
    6.             MsgBox(a)

    this is good stuff...

    Jeff

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