jespermohl Posted July 31, 2006 Posted July 31, 2006 How do I modify the data in my datatable, when it allready contains a row with the primary key? I don't know how to find the index? in C#. Quote
MickD Posted August 1, 2006 Posted August 1, 2006 Do you want to change one record in particular of the currently available one? to iterate the records - foreach(DataRow dr in dt.Rows) { //change the data in the current record (DataRow) } To get a particular record you would need a query to get the record such as - Select SomeRecordColumnData from mytable where SomeOtherRecordsColumnData = "SomeParticularData"; Then you should have a dataset with one datatable with one DataRow or record. Change it by something like- dr["SomeRecordColumnData"] = "Some new data"; Then you have to use the dataAdaptors's Update method to 'merge' your data set with the original database. hth, Mick. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.