A
al
Greetings,
How can I export two datatables in one dataset to two XML files
separtely. I tried but no luck. The result I get is 1 datatable in
one XML file and 2 datatables in the other XML file, this is the code:
Dim cnstring As String = "data source=pc1; initial
catalog=northwind;integrated security=sspi"
Dim cn As SqlConnection = New SqlConnection(cnstring)
Dim sqlemployees As String = "select * from employees"
Dim sqlcustomers As String = "select * from customers"
Dim ds As New DataSet
Dim Daemp As New SqlDataAdapter(sqlemployees, cnstring)
Dim dacus As New SqlDataAdapter(sqlcustomers, cnstring)
Private Sub employees_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles employees.Click
Daemp.Fill(ds, "employees")
ds.WriteXml("C:\testemployees.xml")
End Sub
Private Sub customers_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles customers.Click
dacus.Fill(ds, "customers")
ds.WriteXml("C:\testcustomers.xml")
End Sub
MTIA,
Grawsha
How can I export two datatables in one dataset to two XML files
separtely. I tried but no luck. The result I get is 1 datatable in
one XML file and 2 datatables in the other XML file, this is the code:
Dim cnstring As String = "data source=pc1; initial
catalog=northwind;integrated security=sspi"
Dim cn As SqlConnection = New SqlConnection(cnstring)
Dim sqlemployees As String = "select * from employees"
Dim sqlcustomers As String = "select * from customers"
Dim ds As New DataSet
Dim Daemp As New SqlDataAdapter(sqlemployees, cnstring)
Dim dacus As New SqlDataAdapter(sqlcustomers, cnstring)
Private Sub employees_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles employees.Click
Daemp.Fill(ds, "employees")
ds.WriteXml("C:\testemployees.xml")
End Sub
Private Sub customers_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles customers.Click
dacus.Fill(ds, "customers")
ds.WriteXml("C:\testcustomers.xml")
End Sub
MTIA,
Grawsha