Board index » delphi » "Connection is in use by another statement" error message using Delphi 1.0 against MS-SQL Server 6.0

"Connection is in use by another statement" error message using Delphi 1.0 against MS-SQL Server 6.0

HELP!!

I'm using a TForm, with 6 TTables. 5 of the TTables are linked via the
master source property into 1 central TTable. All of the TTables are
MS-SQL 6.0 tables.

My workstation is a Win95 PC with 32 meg of memory.

The sequence of events go like this: Open the form with the tables on
it. Click at bit button which calls an Edit on the central/parent
table, that the other 5 tables are linked to. Tab over to one of the
fields and make a change in the field value. When I tab out of the
field, BOOM! I get a run-time error that states: "Connection is in use
by another statement."

There are no Object Events tied to the TTable, DataSource, or TField
objects. It's just plain jane.

Has anyone come across anything like this? Anyone have any solutions
or ideas?

 

Re:"Connection is in use by another statement" error message using Delphi 1.0 against MS-SQL Server 6.0


I'm not sure how Delphi connects to a database, but when this happens using
ODBC the problem is because SQL Server only supports one active statement
per connection.  A statement is still active while there are rows remaining
to be retrieved from the server.  To get around this force each query(ie
statement) to completion, in other words retrieve all the rows, before
retrieving from another.  Then you should be able to retrieve off another
statement.

bruh <b...@mindspring.com> wrote in article
<5ijp91$...@camel4.mindspring.com>...

Quote
> HELP!!

> I'm using a TForm, with 6 TTables. 5 of the TTables are linked via the
> master source property into 1 central TTable. All of the TTables are
> MS-SQL 6.0 tables.

> My workstation is a Win95 PC with 32 meg of memory.

> The sequence of events go like this: Open the form with the tables on
> it. Click at bit button which calls an Edit on the central/parent
> table, that the other 5 tables are linked to. Tab over to one of the
> fields and make a change in the field value. When I tab out of the
> field, BOOM! I get a run-time error that states: "Connection is in use
> by another statement."

> There are no Object Events tied to the TTable, DataSource, or TField
> objects. It's just plain jane.

> Has anyone come across anything like this? Anyone have any solutions
> or ideas?

Re:"Connection is in use by another statement" error message using Delphi 1.0 against MS-SQL Server 6.0


Dan,

Thanks for taking time to respond. I'll give your suggestion a try. If
you don't hear from me again, know that all went well.

Many thanks,
Bruh.

Quote
"dan akers" <dak...@mcs.com> wrote:
>I'm not sure how Delphi connects to a database, but when this happens using
>ODBC the problem is because SQL Server only supports one active statement
>per connection.  A statement is still active while there are rows remaining
>to be retrieved from the server.  To get around this force each query(ie
>statement) to completion, in other words retrieve all the rows, before
>retrieving from another.  Then you should be able to retrieve off another
>statement.
>bruh <b...@mindspring.com> wrote in article
><5ijp91$...@camel4.mindspring.com>...
>> HELP!!

>> I'm using a TForm, with 6 TTables. 5 of the TTables are linked via the
>> master source property into 1 central TTable. All of the TTables are
>> MS-SQL 6.0 tables.

>> My workstation is a Win95 PC with 32 meg of memory.

>> The sequence of events go like this: Open the form with the tables on
>> it. Click at bit button which calls an Edit on the central/parent
>> table, that the other 5 tables are linked to. Tab over to one of the
>> fields and make a change in the field value. When I tab out of the
>> field, BOOM! I get a run-time error that states: "Connection is in use
>> by another statement."

>> There are no Object Events tied to the TTable, DataSource, or TField
>> objects. It's just plain jane.

>> Has anyone come across anything like this? Anyone have any solutions
>> or ideas?

Re:"Connection is in use by another statement" error message using Delphi 1.0 against MS-SQL Server 6.0


Quote
On Mon, 14 Apr 1997 14:15:29 GMT, b...@mindspring.com (bruh) wrote:
>Dan,

>Thanks for taking time to respond. I'll give your suggestion a try. If
>you don't hear from me again, know that all went well.

>Many thanks,
>Bruh.

>"dan akers" <dak...@mcs.com> wrote:

>>I'm not sure how Delphi connects to a database, but when this happens using
>>ODBC the problem is because SQL Server only supports one active statement
>>per connection.  A statement is still active while there are rows remaining
>>to be retrieved from the server.  To get around this force each query(ie
>>statement) to completion, in other words retrieve all the rows, before
>>retrieving from another.  Then you should be able to retrieve off another
>>statement.

A cleaner method would be to use transaction control through a
TDatabase component. This sould enable you to rollback transactions to
your heart's content, without causing locking problems either for
yourself or for others using the same database.

Ha...@advsystems.demon.co.uk

Note: the opinions expressed in this opinion do not necessarily
represent the opinions of the opinionated person expressing the
opinion. Or something.

Re:"Connection is in use by another statement" error message using Delphi 1.0 against MS-SQL Server 6.0


i think you should use the TSession rather than the TDatabase component. In
Delphi 1 there is one Session component that is created altomatically for
the application, if you can create another instance of it you could
associate the different quiries each with a different session. this would
enable both to be run side by side.

I think

Martin.

Other Threads