thiyagz
asked on
Load XML into a Dataset and Update DataSource( VB.NET)
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
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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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 ).ColumnNa me.ToStrin g() & " "
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
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
SqlString = SqlString & x.Tables(0).Columns(ColCtr
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
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
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
ASKER
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