Board index » delphi » Open connections with TTable-components to SQL - server 7.0 during runtime

Open connections with TTable-components to SQL - server 7.0 during runtime

I've made a dataset in my application with a lot of TTables on it.
When my application strart all the TTable are made active.
When I look in the SQL Profiler I see as much connections as I've
TTable-components and everything is so slow.
Is there another way to connect to the SQL Server 7.0 with only one
connection ?.

I've also problemens with updating and deleting records from a
TTable-component (the application hangs when I try to delete a record).

Sander

 

Re:Open connections with TTable-components to SQL - server 7.0 during runtime


Hiya Sander :)

Im not sure I understand your problem, but here goes anyway.
You should use a TDatabase component for your connection, not aliases
created through the BDE manager. By doing this you should manage to have
only one connection.

Also, while your are working with an RDBS, never use the TTable component.
Always use TQuery. TTable pushes way to much data over the network.
 unfortunately so does the BDE with its constant refreshes)

Hope it helps ( at least a little )

Quote
Sander Fickweiler wrote in message <01be9b82$abd465f0$0200de80@sander>...
>I've made a dataset in my application with a lot of TTables on it.
>When my application strart all the TTable are made active.
>When I look in the SQL Profiler I see as much connections as I've
>TTable-components and everything is so slow.
>Is there another way to connect to the SQL Server 7.0 with only one
>connection ?.

>I've also problemens with updating and deleting records from a
>TTable-component (the application hangs when I try to delete a record).

>Sander

Re:Open connections with TTable-components to SQL - server 7.0 during runtime


Quote
>I've made a dataset in my application with a lot of TTables on it.
>When my application strart all the TTable are made active.

This is a no no for SQL Server Applications

Quote
>Is there another way to connect to the SQL Server 7.0 with only one
>connection ?.

Use Queries instead of tables

Quote
>I've also problemens with updating and deleting records from a
>TTable-component (the application hangs when I try to delete a record).

Sounds like you're locking yourself with another Table. See MS SQL Server
Enterprise for the offending lock.

If you use queries , you can use "no lock" statement with SQLPassThrough.

HTH
Bernd
--
Bernd Ua - Software-Haus Brumund GmbH
u...@nospambrumund.de
// to reply, remove nospam from email adress :-)
// obviously this needs to be stated, too :  please no unsolicited private email
unless explicitly invited

Re:Open connections with TTable-components to SQL - server 7.0 during runtime


Generally speaking TQuery is better than TTable for client / server
backends.  However, one quick fix in your situation would be to set the
active property on your TTables to false and then open them as needed in
your application.

If you use a TDatabase component, I believe that will limit the number of
connections.  However, reducing the number of connections may also slow
your application.  I am not a MSSQL techie guru so I can't really give a
precise answer about the positive and negatives of the number of
connections.

As mentioned in the other response, the table you are trying to delete from
may be locked by one of your other operations, which is effectively
blocking your delete from completing.

John

Quote
Sander Fickweiler wrote:
> I've made a dataset in my application with a lot of TTables on it.
> When my application strart all the TTable are made active.
> When I look in the SQL Profiler I see as much connections as I've
> TTable-components and everything is so slow.
> Is there another way to connect to the SQL Server 7.0 with only one
> connection ?.

> I've also problemens with updating and deleting records from a
> TTable-component (the application hangs when I try to delete a record).

> Sander

Other Threads