How You Can Close the SQLSelect Object
To close an SQLSelect object, invoke DataStream's Close method. It is necessary to close the SQLSelect object before changing any of the query parameters and reexecuting it. Attempting to close an SQLSelect object that is not open, or open one that is still active, causes an error.
The following code closes the SQLSelect object:
if ss.State = QS_ACTIVE then
ss.Close();
endif;
When you close an SQLSelect object that was opened in cache mode, you clear it of all data. Therefore, do not close the query until the user has selected an operation that uses different data.