?
Solved

Load XML  into a Dataset and Update DataSource( VB.NET)

Posted on 2003-03-13
5
Medium Priority
?
670 Views
Last Modified: 2012-06-21
Hello Experts,

       I have an XML file and i need to fill a dataset using that XML file and update the same in the data source (Say SQL Server). I am aware that many ways are there but i need to choose an optimistic procedure for this. Please Suggest a  Way to Do this.......Thanks in Advance.....

I try to do this in VB.NET and SQL Server


Regards..,
Thiyagz
0
Comment
Question by:thiyagz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 28

Accepted Solution

by:
iboutchkine earned 300 total points
ID: 8135859
'save xml to dataset
ds.ReadXml(YourXMLFIle)

now you can read your dataset and do all the updates to the SQL table
0
 

Author Comment

by:thiyagz
ID: 8137546
Friends.....,

     An Addition to the Question...? I need to add the data in the XML file in new table....Please Suggest me Some Code Samples...Thanks in Advance...

With Regards,
Thiyagz
0
 
LVL 1

Expert Comment

by:spackd
ID: 8141448
thiyagz,
I am sure this is not the easiest method but you could do something like:
        Dim x As New Dataset1()
        Dim TblName As String = x.DataSetName
        Dim ColCtr As Integer
        Dim SqlString As String = "CREATE TABLE " & TblName & " ("

        Do While ColCtr < x.Tables(0).Columns.Count
            SqlString = SqlString & x.Tables(0).Columns(ColCtr).ColumnName.ToString() & " "
            SqlString = SqlString & x.Tables(0).Columns(ColCtr).DataType.ToString() & ", "
            ColCtr = ColCtr + 1
        Loop
        SqlString = SqlString & ")"

Then run this SqlString against the DB to create the table. I haven't run this code, so it may not be perfect, but should give you an idea.
-spackd
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 9671511
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Answered by iboutchkine

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

TheLearnedOne
EE Cleanup Volunteer
0

Featured Post

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It seems a simple enough task, yet I see repeated questions asking how to do it: how to pass data between two forms. In this article, I will show you the different mechanisms available for you to do just that. This article is directed towards the .N…
This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question