Changing row or column status programmatically
You might need to change the status of a row or column programmatically. Typically,
you do this to prevent the default behavior from taking place. For example,
you might copy a row from one DataWindow to another; and after the user
modifies the row, you might want to issue an UPDATE statement instead of
an INSERT statement.
You use the SetItemStatus method to programmatically change
a DataWindow’s row or column status information. Use the
GetItemStatus method to determine the status of a specific row or
column.
Changing column status
You use SetItemStatus to change the column status from DataModified!
to NotModified!, or the reverse.

Changing the row status changes the status of all columns
in that row to NotModified!, so if the Update method is called,
no SQL update is produced. You must change the status of columns
to be updated after you change the row status.
Changing row status
Changing row status is a little more complicated. The following
table illustrates the effect of changing from one row status to
another:
Original |
Specified |
|||
---|---|---|---|---|
New! |
NewModified! |
DataModified! |
NotModified! |
|
New! |
– |
Yes |
Yes |
No |
NewModified! |
No |
– |
Yes |
New! |
DataModified! |
NewModified! |
Yes |
– |
Yes |
NotModified! |
Yes |
Yes |
Yes |
– |
In the preceding table, Yes means the
change is valid. For example, issuing SetItemStatus on a row that
has the status NotModified! to change the status to New! does change
the status to New!. No means that the change
is not valid and the status is not changed.
Issuing SetItemStatus to change a row status from NewModified!
to NotModified! actually changes the status to New!. Issuing SetItemStatus
to change a row status from DataModified! to New! actually changes
the status to NewModified!.
Changing a row’s status to NotModified! or New! causes
all columns in that row to be assigned a column status of NotModified!.
Change the column’s status to DataModified! to ensure that
an update results in a SQL Update.

When you cannot change to the desired status directly, you
can usually do it indirectly. For example, change New! to DataModified!
to NotModified!.