10.07.2015 Views

Programming Guide - Actian

Programming Guide - Actian

Programming Guide - Actian

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

How You Can Work with Text StringsTo check whether the DBHandle was set successfully, use the ErrorStatusattribute. The ErrorStatus attribute is set to ER_OK if the DBHandle setting issuccessful or to a nonzero value if an error occurs.Each time you set the DBHandle attribute, OpenROAD actually loads a copy ofthe string into the StringObject object associated with the field. If the useredits the text in the entry field, these changes are made to the text string inthe StringObject object. To update the corresponding string in the database,use the UpdateInDB method. This method is described in How You Can UpdateStrings in a Database (see page 290).How You Can Update Strings in a DatabaseThere are two ways to update a string in the database:• Replace the string in the database with the current value of theStringObject object.• Replace the old string in the database with the contents of an external file.The following sections describe each of these ways of updating strings.How You Can Replace the Current StringObject ValueReplacing the string in the database with the current value of the StringObjectobject is useful when the user has entered a value into an entry field orchanged the value in the entry field, and you want the update to be reflectedin the database.After the user completes the changes, use the UpdateInDB method to removethe old string from the database and add the new string (the current value ofthe StringObject object) in its place.To make this change, you would perform the following basic steps:1. Set the value of the DBHandle attribute to the DBHandle for the string youwant to replace.2. Allow updates by the user.3. Use the UpdateInDB method to remove the old string from the databaseand add the new string (the current value of the StringObject) in its place.4. Commit the changes to the database.The UpdateInDB method returns ER_OK if successful or a nonzero value ifthere is an error.The new string has the same DBHandle as the old one. For more informationabout error handling for the UpdateInDB method, see Working with a Database(see page 147).290 <strong>Programming</strong> <strong>Guide</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!