Refresh UltraGrid when data-source is changed

Posted by vrtik on 22-Mar-2010 05:55

Hi,

This is the code i use:

METHOD PUBLIC VOID getData(INPUT tableName AS CHARACTER,

                                                INPUT recordId AS INTEGER,

                                                INPUT lineNo AS INTEGER):

DEFINE VARIABLE whereCond AS CHARACTER NO-UNDO.

whereCond =

" AND po_history.table_name = '" + tableName + "'" +

                    " AND po_history.rec_id = " + STRING(recordId) +

                    " AND po_history.line_no = " + STRING(lineNo).

bsHistory:

HANDLE = ?.

connectAppServer =

NEW connectAppServer (OUTPUT hdlAppServer).

RUN sHistoryGetData.p ON hdlAppServer (INPUT whereCond,

                                                              OUTPUT DATASET dsHistory).

DELETE OBJECT connectAppServer.

bsHistory:

HANDLE = DATASET dsHistory:HANDLE.

END METHOD.

bsHistory is a probindingsource which is UltraGrid's datasource.

When the method runs first time, everything's ok. UltraGrid displays all expected records. Second time i'm getting "No ... record is available (91)" error.

Thank you for any help.

All Replies

Posted by jquerijero on 22-Mar-2010 11:36

Create a query against the dataset and assign the query handle instead of the prodataset handle to the bindingsource. I have the same problem when using ProDataset, and it is also slower than using a query handle.

Posted by danielStafford on 22-Mar-2010 14:01

This might work.

define variable hHistoryDS as handle no-undo.

hHistoryDS = DATASET dsHistory:HANDLE.

hHistoryDS:top-nav-query(1):query-open().

bsHistory:HANDLE = hHistoryDS.

Posted by vrtik on 23-Mar-2010 05:30

Thank you very much. It's working fine. I've just didn't noticed any speed difference. It may be because i've got just about 5000 records in ultragrid.

Posted by vrtik on 23-Mar-2010 05:31

This works well too. Thank you

This thread is closed