|
#1
|
|||
|
|||
|
Ok,
I'm having trouble here and not sure what I'm doing wrong. I'm looping through one table and updating rows in another table. When I do the following code: dt.Rows.Add(dr) dt.AcceptChanges() When I view the records in the dt table, the new record is not there?!? Does AcceptChanges() not apply the data to the table? Any help would be greatly appreciated, any links to help would be greatly appreciated. Thank. jb |
|
#2
|
|||
|
|||
|
AcceptChanges does not save the data, it simply marks the DataTable as being synchronized with the data in the database, which in fact prevents any updating to the database table. Most examples you see in textbooks use AcceptChanges without reason, so many programmers tend to use it without knowing what it does.
What you are looking for is the Update method. dt.Rows.Add(dr) dt.Update
__________________
Jacques Bourgeois JBFI http://www3.sympatico.ca/jbfi/homeus.htm |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| editing Rows of the gridview, which is bounded with DataTable | ani.since1982 | ASP.NET | 1 | 12-19-2007 10:11 AM |
| Creating an unbound datagrid | ninel | ASP.NET | 2 | 08-10-2007 04:06 AM |
| adding rows to a grid DTC | Valerie Anover | .NET | 0 | 02-10-2002 07:48 PM |
| Adding rows to Web based Data Grids | Christian | .NET | 3 | 02-09-2002 12:10 AM |
| Adding New Rows | Tim Manos | VB Classic | 3 | 08-27-2001 02:20 PM |