Click here to Skip to main content
15,669,694 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
Im using this code to put xml into dataset and load it to SQL Server Database(table)
dim Infods As New DataSet("Info DataSet")
Infods.ReadXml(String.Format("{0}\Info.xml", systemfilepath))
dim _guid as System.Guid = System.Guid.NewGuid
Dim connection As SqlConnection = New SqlConnection(My.Settings.CollectorConnectionString)
Dim sbc As SqlBulkCopy = New SqlBulkCopy(connection)
'I NEED TO INSER 2 ADDITIONAL COLUMNS
Infods.Tables(0).Columns.Add("CollectedZipID", GetType(System.Guid))
Infods.Tables(0).Columns.Add("CollectedFileName", GetType(System.String))
sbc.DestinationTableName = "MachineInfo"
sbc.ColumnMappings.Add("MachineName", "MachineName")
sbc.ColumnMappings.Add("MachineUserName", "MachineUserName")
sbc.ColumnMappings.Add("OSVersion", "OSVersion")
sbc.ColumnMappings.Add("BootTime", "BootTime")
sbc.ColumnMappings.Add("DSXUtils", "DSXUtils")
sbc.ColumnMappings.Add("EffectPatterns", "EffectPatterns")
sbc.ColumnMappings.Add("CollectedZipID", "CollectedZipID")
sbc.ColumnMappings.Add("CollectedFileName", "CollectedFileName")
connection.Open()
sbc.WriteToServer(Infods.Tables(0))
connection.Close()

Now i need to insert 2 Additional Columns "CollectedZipID" and "CollectedFileName" that are not in xml or in that dataset.Ok that isn't problem "Infods.Tables(0).Columns.Add("CollectedZipID", GetType(System.Guid))...." but i also need to insert in those 2 columns N values(depending how much rows are in dataset table) that are not in xml or in that dataset (one is string that i will get from other source and one is Guid) and then insert that dataset in sql table.i know that somehow i need to loop for each row..some help would be greate.
thanks
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900