Home > Back-end >  Delphi how quickly to save the excel data into the SQLite database
Delphi how quickly to save the excel data into the SQLite database

Time:09-21

Leadership assigned a requirement is to excel in the tens of thousands of data imported into the SQLite,
I use a line-by-line through writing SQLite way too time consuming, so give up,
Later from the Internet to find a software called sqlite - the shell - win32 - x86-3080403, this is very good, tens of thousands of data for a few seconds in the sqlite,
But the downside is the need to manually enter the command line like CMD command to import the data,
Software to open the below

Want to know how to use Delphi program implementation as the input command and executes inside,
I tried to use this as CMD, CMD command, only to open the software, the back of the statement is not performed,
Want to ask if I want the software automatically input code to complete this command to import the data below, how do you achieve?
Command is:
The open D: \ OffLine333 db
. The separator ', '
.import D: \ ICD10 CSV ICD10
Or which there is a better way to compare quickly will guide the excel data into the SQLite also please share,
Thanks a lot!

CodePudding user response:

Recommended XLSReadWriteII4 controls, factor of different EXCWL structure and table field, the difference in writing, the code roughly the second step:


Read data, write the dynamic array
XLS:=TXLSReadWriteII4. Create (Self);
XLS. Read;
For Row:=6 to XLS. Sheets [0]. LastRow - 2 do
The begin
A: [Top, 0]=XLS. Sheets [0]. AsString [0, First];
A: [Top, 1]=XLS. Sheets [0]. AsString [1, First];
A: [Top, 2]=XLS. Sheets [0]. AsString [2, the First];
,,,,,,,,
end;

Write data in the DBGrid
For I:=0 to do Top - 1
The begin
Append.
FieldByName (" date "). AsString:=A (I, 0);
FieldByName (' invoice code). AsString:=A (I, 1);
FieldByName (' invoice number). AsString:=A [I, 2);
Post;
end;
  • Related