for your purpose you don't need to do things by multithreading.
A)
If you use a datawindow and simply put a comment in the "retrieveRow" event:
// no code needed a simple comment does the trick...
your code will continue to execute, while retrieving data.
(thought it does decrease performence).
B) use a new transaction object for your specific datawindow that you want to retrieve without waiting and do a settransobject with that transobject for your dw: you can use the 'Async(hronous)' dbparm when you connect to thisa transaction object. If I'm right the retrieve will also allow your code to continue without waiting for the retrieve to finish and without the need of coding the retrieveRow event. Though in powerbuilder help I read that it is "necesary" to code that event, I seem to remember that it is not ... I'd try to see if that's really necessary since it slows down performence.
(it could be that pb states it to be necesary, for the reason to be able to do a dbcancel() to interrupt the retrieve, but not necesary if you don't want to cancel and simply want the execution to be asynchronous)
Sorry for my lousy forgotten english.
You can do a retrieve of your data 'asynchronously':
------------------------------- (copied the text from pb help):
-----
Description
Allows you to perform asynchronous operations on your database in PowerBuilder. If you have coded a RetrieveRow event for a DataWindow object or report, you can cancel the current database retrieval operation or start another (non-database) operation that does not use the same database connection before the current operation completes. You can also switch to another Windows process while the retrieval takes place.
By default, PowerBuilder operates synchronously.
Applies to
DIR Sybase DirectConnect
IN9 Informix
JDB JDBC
ODBC (if driver and back-end DBMS support this feature)
O84 Oracle 8.x and Oracle8i (8.1.5 and higher database connections only)
O90 Oracle9i
SYC Sybase Adaptive Server Enterprise
Syntax
Async = value
Parameter Description
value A value specifying synchronous or asynchronous operation. Values are:· 0 (Default) Synchronous operation· 1 Asynchronous operation
Default
Async = 0
Usage
Enabling asynchronous operation in PowerBuilder is useful when you are executing a complex SQL statement that takes several minutes to return results. If the Async parameter is set to 1, you can do either of the following while the SQL statement is executing:
· Work in another window
· Cancel the statement before it retrieves the first row of data
When to set Async If you are communicating with the database in code, you can reset the Async value at any time before or after the Transaction object has connected to the database.
How data is retrieved When you retrieve data in a DataWindow object or report, the following steps occur in order:
1 The database server compiles and executes the SQL statement.
2 PowerBuilder retrieves (fetches) the first row of data.
3 PowerBuilder retrieves each subsequent row of data.
What happens before the first row is retrieved While the server is compiling and executing the SQL statement and before PowerBuilder retrieves the first row of data, you must have done both of the following to enable asynchronous operation (allowing you to cancel the current operation before it retrieves the first row of data):
· Coded a RetrieveRow event for the DataWindow object or report (the code can contain only a comment)
· Set the Async parameter to 1
What happens after the first row is retrieved After the first row of data is retrieved and between subsequent row fetches, you must have done only the following to enable asynchronous operation:
· Coded a RetrieveRow event for the DataWindow object or report
After the first row is retrieved, PowerBuilder operates asynchronously without your having to set the Async parameter to 1, so you can cancel the current operation anytime after it retrieves the first row of data. Therefore, the Async parameter has no effect in PowerBuilder after the first row of data is retrieved.
regards,
Miguel L.