By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,808 Members | 1,481 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,808 IT Pros & Developers. It's quick & easy.

Adding a column to a dataset

P: 1
I have a dataset that is populated from a database. I need to add some additional data to the dataset once it is populated. I am successful in addind the additional column. I confirmed this by looping through the columns collection. However, when I write the dataset to a file (ds.writeXML\path\filename), and open the file; I do not see the additional column in the xml file? Any Suggestions? Thanks


code sniplet

.......
sqlDA.Fill(ds)
ds.Tables("Table").TableName = "Details"

'ADD to DATA SET

Dim newCustomersRow As DataRow = ds.Tables("Details").NewRow()
Dim dc As New DataColumn

ds.Tables("Details").Columns.Add("TestField", Type.GetType("System.String"))
newCustomersRow("TestField") = "XXX"
Dim intCount As Int32
Dim i As Integer
Dim s As String
'CHECK COLLECTION
For Each dc In ds.Tables("Details").Columns
intCount = ds.Tables("Details").Columns.Count
s = ds.Tables("Details").Columns.Item(i).ToString
i += 1
Debug.Print(s)
'Next

ds.WriteXml("c:\MyXMLfile.xml")
Apr 18 '07 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.