Home > Back-end >  Is there any faster than while not do circulating method
Is there any faster than while not do circulating method

Time:10-14

Is that there are two correlated relationship between tables, and two table data volume is large, turned out to be like this,
Table1. First;
While not table1. Eof do
The begin
Xh:=table1. Fieldbyname (' xh). Asstring;
Query1. Close;
In query1.sql. Text:='select * from table2 where xh=' "+ xh +" ';
Query1. Open;
If quey1. IsEmpty then exit;
Query1. First;
While not query1. Eof do
The begin
.
Take out the value of the next calculated again,,,,
end;
end;
It think it is slow, is there a way to faster than this, please grant instruction!

CodePudding user response:

Will be completed calculation logic into an SQL,

CodePudding user response:

Use stored procedures to complete,

CodePudding user response:

Then the above example I use stored procedure how to write?

CodePudding user response:

1. To switch to a stored procedure to realize logic
2. Disablecontrol and enablecontrols on the package

CodePudding user response:

Out directly with SQL directly calculation, query and display

CodePudding user response:

Select * from table2 the where the exists (select xh from table1 where table2. Xh=table1. Xh) order by xh

Then loop here each record,

CodePudding user response:

The while loop is 0. X subtle level. With your Query1. Open a heaven and an underground.
Put your Query1 one-time are found out, and then do it again While looking for locally much faster than you again and again database operation.

CodePudding user response:

Use stored procedures, should be compared to the original code faster,

CodePudding user response:

Stored procedure with very little, I mark this post, to learn in the future,
  • Related