Board index » delphi » Open many Tables with SQL 6.5 and BDE

Open many Tables with SQL 6.5 and BDE

TTables are very inefficient to open and take a very long time to open
because of the volume of information the TTable component must retrieve
from the server.  If you can, switch to a TQuery which takes only a
sub-fraction of the time to open.

Kevin

Quote
O. DUCROCQ wrote:
> Hello,

> I use SQL 6.5 and BDE 4.51.
> In my application when i want to open a form,
> I am supposed to open ten or more tables ( 20 max) and it takes a
> very long time.
> Why is it so long?
> With paradox tables, there is no problems.
> What am i missing?

> Sorry for my english.

 

Re:Open many Tables with SQL 6.5 and BDE


Hello,

I use SQL 6.5 and BDE 4.51.
In my application when i want to open a form,
I am supposed to open ten or more tables ( 20 max) and it takes a
very long time.
Why is it so long?
With paradox tables, there is no problems.
What am i missing?

Sorry for my english.

Re:Open many Tables with SQL 6.5 and BDE


Sorry but i am a beginner in C/S Database and SQL. TQuery is only for
a readonly set of recors. How can I do with a DBGrid linked to a
TQuery for insertion, update and delete. Could you give me different
methods?

Re:Open many Tables with SQL 6.5 and BDE


<<TQuery is only for a readonly set of recors>>

Oh.  Well, I better go back and change 100,000 lines of code and recall
some product.  :-)

To perform an insert, update and deletion of entries you must write the
appropriate SQL statement or use other supported methods.  There are many
books on this subject.  I can't give you an easy answer without providing
you a tutorial on using TQuery.  I would suggest that you read up on the
TQuery component and on SQL.

Someone else might jump in here too and provide some additional
direction.

Kevin

Quote
O. DUCROCQ wrote:
> Sorry but i am a beginner in C/S Database and SQL. TQuery is only for
> a readonly set of recors. How can I do with a DBGrid linked to a
> TQuery for insertion, update and delete. Could you give me different
> methods?

Re:Open many Tables with SQL 6.5 and BDE


The TQuery component will give you live queries so long as you follow the
rulesas set out in the Delphi Help as follows

'A live result set for a query against a single table or view is returned if
the query does not contain any of the following:

JOIN, UNION, INTERSECT or MINUS clauses.
 A DISTINCT clause in the SELECT statement.
 Aggregate functions.
 Base tables or views that are not updatable.
 GROUP BY or HAVING clauses.
 Subqueries.
 ORDER BY clauses not based on an index.
 Field names that include SQL reserved words.

Restrictions on live joins

A live result set for a join is returned if:

Only two tables are involved in the join.
 All joins are left-to-right outer joins.
 All joins on Paradox and dBASE tables can be satisfied by existing indexes.
 Output ordering is not defined.
 Each table in the join is a base table.
 All restrictions that apply to live queries are also met.'

If you must use the abaove constructions and still have a live query then
you must use the TUpdateSQL component with your TQuery.

Using the TQuery is very easy. You just place the TQuery on your form the
same as TTable, select the database, and write your SQL statements. There is
plenty of help on writing SQL in the Delphi books and Delphi help, and you
should also look at the SQL Server Books Online which are very good.

If you invest a day in learning how to use the TQuery you will never use
TTable again. TQuery gives you much more control and is so easy to use.

You should run MS SQL Trace while you are programming so that you can see
exactly what SQL statements are being processed by SQL server.

Once you are familiar with using the TQuery and SQL, you should look at
using stored procedures on the Server as this is often better than having
your SQL in Delphi.

Re:Open many Tables with SQL 6.5 and BDE


Thank you for your help. I tried the different methods and Stored
procedures seem to be better...

Richard Proudfoot <richa...@acay.com.au> a crit dans l'article
<6rltd8$7...@forums.borland.com>...

Quote

Other Threads