Sybase 2 Barcode Reader User Manual


 
CHAPTER 6 Controlling Updates in DataWindow Objects
DataWindow Designer User’s Guide 195
Specifying the WHERE clause for update/delete
Sometimes multiple users are accessing the same tables at the same time. In
these situations, you need to decide when to allow your application to update
the database. If you allow your application to always update the database, it
could overwrite changes made by other users:
You can control when updates succeed by specifying which columns
DataWindow Designer includes in the
WHERE clause in the UPDATE or
DELETE statement used to update the database:
UPDATE table...
SET column = newvalue
WHERE col1 = value1
AND col2 = value2 ...
DELETE
FROM table
WHERE col1 = value1
AND col2 = value2 ...
Using timestamps
Some DBMSs maintain timestamps so you can ensure that users are working
with the most current data. If the
SELECT statement for the DataWindow object
contains a timestamp column, DataWindow Designer includes the key column
and the timestamp column in the
WHERE clause for an UPDATE or DELETE
statement regardless of which columns you specify in the Where Clause for
Update/Delete box.
If the value in the timestamp column changes (possibly due to another user
modifying the row), the update fails.
To see whether you can use timestamps with your DBMS, see Connecting to
Your Database.
Choose one of the options in Table 6-1 in the Where Clause for Update/Delete
box. The results are illustrated by an example following the table.