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 Access a Database with DataStream ObjectsThe following code performs these operations:if (MaxRow > 0) thenstatus = ss.NextRow();status = ss.Load();endif;How You Can Get Next and Previous RowsBecause the ss SQLSelect object was opened in QY_CACHE mode, datawas retrieved from the database table into the cache. The data is notdirectly displayed on the form. Therefore, the example code invokes theNextRow method to move the next row (in this case the first row) from thecache to internal buffers, and the Load method to move it from internalbuffers to fields (or variables) in the frame.Suppose that your frame has buttons labeled Next and Previous. The followingcode shows how you can use these buttons to fetch the next and previousrows:/*** Initialize the buttons.*/if (ss.CurRow >1) thenfield(prev_btn).CurBias = FB_CHANGEABLE;elseendif;field(prev_btn).CurBias = FB_DIMMED;if (ss.CurRow = ss.MaxRow) thenfield(next_btn).CurBias = FB_DIMMED);endif;field(prev_btn).CurBias = FB_CHANGEABLE;Working with a Database 173

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

Saved successfully!

Ooh no, something went wrong!