|
-
Jun 28th, 2002, 10:06 AM
#1
Thread Starter
Registered User
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:
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
-
Jun 28th, 2002, 11:30 AM
#2
Thread Starter
Registered User
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:
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
-
Jun 28th, 2002, 11:31 AM
#3
Thread Starter
Registered User
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:
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|