This morning, it was quite strange. First, the snow floated for a few minutes, almost at intervals. The snow stopped, and several hail were lost, and the brakes stopped, and then it squeezed out some rain,
I am still in a hurry ......
Now, let's get down to the truth. I learned how to create a record in the previous section. In this section, I will talk about how to operate a single record.
Before you operate a record, make a comparison between the modified record and the modified one.
Public bool isdirty
{
Get
{
Foreach (string key in originaldata. Keys)
{
If (originaldata [Key]! = Currentdata [Key])
{
Return true;
}
}
Return false;
}
}
Public bool isnew
{
Get
{
Return isnew;
}
}
Public bool isdeleted
{
Get
{
Return isdeleted;
}
}
For deleting a record, it will always be:
Public void Delete ()
{
Isdeleted = true;
}
When a new record is created, isnew = true; isdeleted = false.
At this point, we are ready together. The following is the method of the record class, which is also the focus of record operations.SubmitAndReturn Value:
Public void
Acceptchanges ()
{
Originaldata = new dictionary <string, Object>
(Currentdata );
Isnew = false
;
}
Public voidRejectchanges ()
{
Currentdata = new dictionary <string, Object>(Originaldata );
Isdeleted = false;
}
It is easy to understand that if the user acceptchanges data, the new dataset (currentdata) will be used to overwrite the source dataset (originaldata );
Otherwise, no.
OK. Now we have finished creating and operating a single record. Isn't it very easy .......
With this foundation, you can create a record set and store the record set. The next section describes how to make a record set and
How to operate the record set -----
^ _ ^