PDA

Click to See Complete Forum and Search --> : reading a dataset


jkw119
Jun 28th, 2002, 10:06 AM
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.


Dim myStream As System.IO.Stream
Dim openFileDialog1 As New OpenFileDialog()

openFileDialog1.Title = "Open an XML file to analyze"
openFileDialog1.InitialDirectory = "c:\"
openFileDialog1.Filter = "xml files (*.xml)|*.xml|All files (*.*)|*.*"
openFileDialog1.FilterIndex = 1
openFileDialog1.RestoreDirectory = True

If openFileDialog1.ShowDialog() = DialogResult.OK Then
myStream = openFileDialog1.OpenFile()
ProfileName = openFileDialog1.FileName
MsgBox(ProfileName)

Dim newDataSet As New DataSet()
newDataSet.ReadXml(ProfileName)
DataGrid1.SetDataBinding(newDataSet, "point")
If Not (myStream Is Nothing) Then
myStream.Close()
End If
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

jkw119
Jun 28th, 2002, 11:30 AM
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...



Dim newDataSet As New DataSet()
newDataSet.ReadXml(ProfileName)

Dim a As Single
a = newDataSet.Tables(0).Rows(0)(1)
MsgBox(a)


this is good stuff...

Jeff

jkw119
Jun 28th, 2002, 11:31 AM
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...



Dim newDataSet As New DataSet()
newDataSet.ReadXml(ProfileName)

Dim a As Single
a = newDataSet.Tables(0).Rows(0)(1)
MsgBox(a)


this is good stuff...

Jeff