OPENXML

  • Thread starter Thread starter Roy
  • Start date Start date
R

Roy

This is my first time trying to use XML.
Here is the situation:
I need to read and parse about 500000 records from a txt file. Then I need
to insert it into SQL Server 7 in the most effecient way.
I am writting the xml to a file using a typed dataset.
Next, I need to insert the data to a SQL table.
From the examples I have seen, the zml document need to begin with <root>
and terminate with </root>.
The xml document that the dataset created did not contain those tags. Is
there a setting taht will cause the dataset to insert these tags? If not,
how would you go about doing it, through code?
Your help and patience will be appreciated.
Roy
 
Hi Roy,

Roy said:
This is my first time trying to use XML.
Here is the situation:
I need to read and parse about 500000 records from a txt file. Then I need
to insert it into SQL Server 7 in the most effecient way.
I am writting the xml to a file using a typed dataset.
Next, I need to insert the data to a SQL table.
From the examples I have seen, the zml document need to begin with <root>
and terminate with </root>.
The xml document that the dataset created did not contain those tags. Is
there a setting taht will cause the dataset to insert these tags?

If you set dataset.DataSetName = root it will have a root node.

If not,
how would you go about doing it, through code?
Your help and patience will be appreciated.

Once you have a dataset with rows marked as Added you have to create one
dataadapter per table with InsertCommand.
(Creating dataadapter is easy - just drag & drop the table from Server
Explorer window at design time)
Open connection, then call adapter's Update method on dataset, close
connection.
Something like that.
Check out
Using a DataSet with Existing Data
..net help topic.
 
Thanks,
That is what I needed.
Roy

Miha Markic said:
Hi Roy,



If you set dataset.DataSetName = root it will have a root node.

If not,

Once you have a dataset with rows marked as Added you have to create one
dataadapter per table with InsertCommand.
(Creating dataadapter is easy - just drag & drop the table from Server
Explorer window at design time)
Open connection, then call adapter's Update method on dataset, close
connection.
Something like that.
Check out
Using a DataSet with Existing Data
.net help topic.
 
Back
Top