how to create reader from data set

J

Jon Paal

I have a dataset created from an xml file
how can I create a datareader (dataview ?) ?? to return sql results

===========
Dim ds As New DataSet()
Dim sr As New StringReader(my_xmlData)
ds.ReadXml(sr)

'query the dataset
'----------------------------
Dim sql As string = "Select [bla bla] From [bla bla] Where [bla bla]"

'
' ------what goes here to create datareader (dataview ?) ???????
'


'check for existence of records
'-------------------------------------------
Dim dr As System.Object
dr= myCommand.ExecuteReader()

if dr.HasRows then
While dr.read

'retrieve data
'bla bla bla.....

End While
end if
 
G

Guest

Hi Jon,

You can loop thru datatable in dataset to get data:

If ds.Tables(0).Rows.Count > 0 Then
For Each row As DataRow In ds.Tables(0).Rows
Dim data1 As String = row(col_index1).ToString
Dim data2 As Integer = CType(row(col_index2), Integer)
' ....

Next
End If

HTH

Elton Wang
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,071
Latest member
MetabolicSolutionsKeto

Latest Threads

Top