Home > Back-end >  On C/S under the Clientdataset bulk import problem of Oracle database
On C/S under the Clientdataset bulk import problem of Oracle database

Time:10-19

Each prawn, consult a stringgird data import problem of oracle database, record number more than 50000 of stringgrid, original implementation approach is to insert a detailed database:
For I=0 to stringgrid. Do the rowcount - 1
The begin
STRSQL:="insert into XXX (aa and bb) values (' ' '+ a + 1' ' ', ' '+ value 2 +') '.
Exec_sql (adofree, STRSQL);
end;
But found the import time is 2 minutes, then consider using a memory table clientdataset way import, is implemented as follows:
Are: 1, the use of control under the ODAC Orasession and oraquery clientdataset, datasetprovider four controls. Clientdataset Providername set to datasetprovider; Datasetprovider controls the dataset property is set to oraquery; Oraquery session attributes set to Orasession Orasession for with oracle database connection,
The clientdataset forms created by running type are consistent with the database table AA,

2, the code is as follows:
With oraquery do
The begin
The close;
SQL. The clear;
SQL. The add (select * from AA);
The open;
end;

Clientdataset. Close;
Clientdataset. Fielddefs. The clear;
With clientdataset do
The begin
Add (' LX, ftstring, 6, false);
Add (' BH, ftstring, 6, false);
end;
Clientdataset. Createdataset;
Clientdataset. Open;

For I=0 to the grid. Do the rowcount - 1
The begin
Clientdataset. Append;
Clientdataset. Fieldbyname (' LX). Asstring:='XXX';
Clientdataset. Fieldbyname (' bh). Asstring:='XXX';
Clientdataset. POST;
end;
Clientdataset. Applyupdate (0);
Clientdataset. Emptydataset;

After the operation found no response program, isn't me this writing is wrong?

CodePudding user response:

Where there is no response with the code to see see? Also can be in clientdataset. POST; Article 100 when the submit one, and then add a response function, such as Application. ProcessMessages.

CodePudding user response:


There a lot data if it is the above statement is ok
  • Related