Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Adding XML to a Table
Message
From
25/07/2003 13:22:13
Jim Rieck
Quicken Loans/Rock Financial/Title Sourc
Livonia, Michigan, United States
 
 
To
All
General information
Forum:
ASP.NET
Category:
Databases
Title:
Adding XML to a Table
Miscellaneous
Thread ID:
00813556
Message ID:
00813556
Views:
35
All,

I have created a program that works with both XML and SQL Server. One of the things I want to be able to do is add XML data to a table that the user selects. I have tried for hours and hours to get this to work with the Command builder object, but have failed. The code I have is below. My questions are What is wrong with the code? Second, Is there a better way to import XML data into a dataset?

Any thoughts would be appreciated!

Here's the code:
Dim cmdBuilder As SqlClient.SqlCommandBuilder
Dim oTableImport As New TableImport(Me.oParentForm.activeTableName)
oTableImport.ShowDialog()
Me.oParentForm.activeConnection.Open()
oParentForm.daBrowse.SelectCommand.CommandType = CommandType.Text
oParentForm.daBrowse.SelectCommand.CommandText = "Select * from " + oTableImport.Table
oParentForm.daBrowse.SelectCommand.Connection = oParentForm.activeConnection
cmdBuilder = New SqlClient.SqlCommandBuilder(oParentForm.daBrowse)
oParentForm.daBrowse.Fill(dsGridData, oTableImport.Table)
cmdBuilder.GetDeleteCommand()
cmdBuilder.GetUpdateCommand()
cmdBuilder.GetInsertCommand()
oParentForm.daBrowse.Update(dsGridData, oParentForm.activeTableName)
dsGridData.AcceptChanges()
Me.oParentForm.activeConnection.Close()
Thanks

Jim
Next
Reply
Map
View

Click here to load this message in the networking platform