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 StringsHow You Can Load a String into the DatabaseUse the InsertIntoDB method to add a string to the table you specify or, if youdo not specify a table, to the system table.Note: To use a string storage table other than the system table, you must setit up as described in How You Can Create a String Storage Table (seepage 292).To load a string into the database, you would perform the following basicsteps:1. Define a varchar(76) column to hold the DBHandles in the table thatcontains the data for the application.2. Decide whether to store the strings in the system table or your own table.3. If the text string is in a text file, set the FileHandle attribute of theStringObject to the file name. (If the user has entered the text into anentry field, the string is already stored in the StringObject object and it isnot necessary to set the FileHandle attribute.)For this step, if there is an entry field on your form, you can use theStringObject object associated with the entry field. If there is no entryfield, declare a variable of type StringObject to use for loading the text.4. Use the InsertIntoDB method to insert the string in the StringObject objectinto the database table.After this method completes, OpenROAD stores the new DBHandle for thestring in the DBHandle attribute.5. Add the current value of the DBHandle attribute to your database table sothat you can access the string the next time you need it.6. Commit the changes to the database.For more information about error handling for the InsertIntoDB method, seeWorking with a Database (see page 147).The string is now stored in the database. You can display the string time bysetting the DBHandle attribute, and you can replace or delete the string ifnecessary with the UpdateInDB and DeleteFromDB methods respectively.These methods are described in How You Can Display a String from aDatabase (see page 289) and How You Can Update Strings in a Database (seepage 290).How You Can Display a String from a DatabaseTo display a string stored in a database, use the DBHandle attribute of theStringObject object that is associated with the entry field. Set the value of theDBHandle attribute to the value of the DBHandle for the particular string.Working with Images and Text Strings 289

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

Saved successfully!

Ooh no, something went wrong!