Thread View: borland.public.cppbuilder.database.multi-tier
1 messages
1 total messages
Started by Steve Pietrykoski
Mon, 19 Jul 1999 00:00
Using TThread to open a query in a RDM: general SQL error
Author: Steve Pietrykoski
Date: Mon, 19 Jul 1999 00:00
Date: Mon, 19 Jul 1999 00:00
49 lines
1957 bytes
1957 bytes
Hello all,
In BCB4 Unleashed, a technique of opening a query in a thread is
demonstrated in a two-tier app. I am trying to apply this technique in
a three-tier app, with limited success. I have a RDM with a TDatabase
and a TSession set to AutoSessionName. When I open a query from this
RDM in a thread I receive the following error: "General SQL error:
Connection does not exist." Funny thing, the client still shows the
query properly after the error. What is this error trying to tell me?
Following is the code for the thread object I am using. I have tried
not disconnecting and reconnecting the provider, to no avail.
__fastcall TQueryThread::TQueryThread( TProvider* Provider ) : TThread(
true )
{
FProvider = Provider;
FreeOnTerminate = true;
Resume();
}
void __fastcall TQueryThread::Execute()
{
try {
FQuery = (TQuery *)FProvider->DataSet;
Synchronize( DisconnectProvider );
FQuery->Open(); // <--- error right here
Synchronize( ConnectProvider );
}
catch (Exception* E) {
FQueryException = E;
Synchronize( ShowQryError );
}
}
void __fastcall TQueryThread::DisconnectProvider()
{
FProvider->DataSet = NULL;
}
void __fastcall TQueryThread::ConnectProvider()
{
FProvider->DataSet = FQuery;
}
void __fastcall TQueryThread::ShowQryError()
{
Application->ShowException( FQueryException );
}
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads