Have an XML file that i load in to a Dataset. works fine, it builds its own scheme perfectly.
I loop through that data to load a check list which also works wonderfully.
two questions based on that.
1) can i add a column after the fact? I want to basically update the the info in the dataset to store if the record was checked in the check list. if not, i can manipulate one of the already defined columns, but i would rather not.
2) what is the best way to update data with in the dataset? Never really done anything but pull data from one. how do i locate the correct row to update ("select name from tbl where name = " + checklist.items[index].tostring(); update row)
sorry for the fairly basic question. i appreciate the help.
Justin
re #1: You can add columns to dataset tables at any time.
DataColumn _dc =newDataColumn("newcolumnname");mydataset.Tables[0].Columns.Add(_dc);
re #2: You are asking more than just updating. You are asking how to find the row to update as well.
Create a DataView object to pass in QueryStatements to find the records you want.
Then edit the field value, something such as:
"newcolumnname"] ="newvalue";mydataset.Tables[0].Rows[4][
mydataset.AcceptChanges();
|||great, thanks. not really shore how i missed the column.add, i was even looking for that...
I found something else i might try for the locate and update. because it reads from an XML with no schema it doesnt create a PK. I was going to set a PK (MyDataTable.PrimaryKey = PKColumn) and then use the Find method to locate the row i want (myDataTable.Rows.Find(objValue))
not sure how it will workout, going to give it a try. if not i can do as you suggested.
I appreciate the help.
Thanks
Justin