Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
DataRow.BeginEdit, EndEdit, and AcceptChanges methods
Message
From
31/01/2005 21:13:45
 
 
To
All
General information
Forum:
ASP.NET
Category:
ADO.NET
Title:
DataRow.BeginEdit, EndEdit, and AcceptChanges methods
Environment versions
Environment:
C# 1.1
Database:
MS SQL Server
Miscellaneous
Thread ID:
00982570
Message ID:
00982570
Views:
107
I want to retrieve data from a database, compare it data in a text file, update the data table to match the text file, and keep track of which records in the database were not checked because they weren't listed in the text file.

I added a column to my datatable called "IsChecked" that holds a boolean value initialized to false. As I examine each row, I set IsChecked = true. Unchecked rows are VERY rare.

Only a small number of rows actually differ from the data in my text file and I only want to send update statements to the database for rows which really require updates.

My problem is that setting IsChecked = true sets the RowState value for the row to Modified even if though the other columns don't get changed, so that when I save, an update statement for every row is sent back to the DB.

I couldn't find a way to use BeginEdit, EndEdit, and AcceptChanges to make it work. Deleting the IsChecked column didn't help, either.

Am I just misusing my DataTable by using it to store information that doesn't exist in my database? Should I track which rows have been read in a separate data structure?

If anyone can recommend an online resource that will help me understand how to use this IsChecked column without DataRows thinking that they have really been changed, I would appreciate it.
David S. Alexander
Kettley Publishing
20271 SW Birch Street, 2nd Floor
Newport Beach, CA 92660-1752
Next
Reply
Map
View

Click here to load this message in the networking platform