Re: Populate dataset with text file



Commenting out the inserts, It takes about 45 seconds to populate a text box
one row at a time.
If I use Memo1.Lines.LoadFromFile I can populate a memo control in less than
a second.

strPath := 'C:\Program
Files\Borland\Delphi7\Projects\PPM\832\00000001.832';
Memo1.Lines.LoadFromFile(strPath);

Below is a sample of the actual file after being read into the memo control:

ISA*00* *00* *01*045840055 *ZZ*POTOMFC
*050524*1230*U*00400*000000001*0*P*>
GS*SC*045840055*POTOMFC*20050524*1230*1*X*004010
ST*832*0001
BCT*PS
CUR*SE*USD
REF*11*0022096
LIN**GS*AL021*MF*SHAW IND*ST*AL021*****MS*AL021*MN*MADISON II
DTM*007*20040507
REF*GP*ABBEY
REF*19**60 HARD SURFACES WHOLES
REF*GG*CUT PILE
PID*F*TRN***MADISON II
PID*F*MAC***LAMFLO
PID*F*CO***ABBEY LAMINATE
PID*F*12***WOOD LAMINATE FLOORS
MEA**LN*047.00
MEA**WD*011.00
CTP**LPR*2.72*0*SF****ST
CTP**LPR*0*1*SF****CT
G43*003**ZONE2
SLN*00001**O******SK*AL02100170*****ST*AL021*****MS*AL021*MN*MADISON II
PID*F*73***SANIBEL

If I can find a way to simple either make a temp table or populate an
existing table using the asterisk as a field delimiter, I am thinking it
should take considerably less time than populating a dataset one record at a
time.

By the way, Bill, thanks for hanging in there with me on this.

"Bill Todd" <no@xxxxxx> wrote in message
news:430a7cff$1@xxxxxxxxxxxxxxxxxxxxxxxxx
>I would be very interested to know the time it takes for the 147,000
> records if you comment out the code that actually inserts the row into
> the database table. There are other ways to do the import that might be
> faster.
>
> Also, how are you adding the records to the table. ADO will be much
> slower than the Advantage TDataSet components. The two possibilities
> are a TAdsTable or a TAdsQuery using a parameterized insert statement.
> I would expect the TAdsTable to be faster but I have not tested this.
>
> --
> Bill Todd (TeamB)


.



Relevant Pages

  • Re: Populate dataset with text file
    ... > populate a memo control in less than a second. ... query component, what is the SQL? ...
    (borland.public.delphi.database.ado)
  • Re: DBGrid to TList
    ... I want to populate a Tstringlist ... GridDataSet is the dataset component that supplies data to the DbGrid. ... Bill Todd (TeamB) ...
    (borland.public.delphi.database.ado)