![]() |
|
#1
|
|||
|
|||
|
hi everybody . . .
i have a problem with my access db application, i have 450.000 records and i want to post to my access db all of them . . . my code is like that : [DELPHI] for i := 0 to 450000 do begin qryPost := TADOQuery.Create( nil ) ; qryPost.Connection := ADOConnection1 ; qryPost.sql.text := 'insert into tbl_records(r_name, r_number) select ' + QuotesStr( 'baykus' )' + ' as name, ' + inttostr(i) + ' as number;' ; qryPost.execsql ; qryPost.Free ; end ; [/DELPHI] this works for few minutes, then causes an exception "out of memory" . . . how can i free the memory and destroy the error . . . please help . . . ( sorry for my english ) thanks . . . |
|
#2
|
|||
|
|||
|
Try:
[DELPHI]var i : Integer; qryPost : TADOQuery; begin qryPost := TADOQuery.Create( nil ) ; qryPost.Connection := ADOConnection1 ; ADOConnection1.BeginTrans; for i := 0 to 450000 do begin qryPost.sql.text := Format('insert into tbl_records (r_name,r_number) VALUES (%s,%d)',[QuotedStr('baykus'),i]); qryPost.execsql ; end ; ADOConnection1.CommitTrans; qryPost.Free ;[/DELPHI] Regards, Abdulaziz Jasser |
|
#3
|
|||
|
|||
|
same thing happens . . .
[DELPHI] ADOConnection1.BeginTrans; for i := 0 to 450000 do begin qryPost.sql.text := Format('insert into tbl_records (r_name,r_number) VALUES (%s,%d)',[QuotedStr('baykus'),i]); qryPost.execsql ; end ; ADOConnection1.CommitTrans; [/DELPHI] |
|
#4
|
|||
|
|||
|
Baykus,
You must be doing somthingelse besides inserting records. I know for sure ADO is not a stable solution. But your case is wired. So tell me: 1- How much memory does your pc have? 2- What version of Windows are you using? 3- What version of Delphi are you using? 4- Are there any other events/procedures/threads are using? 5- What DB Engine are you using? 6- Are there any other VCL components connected to the table or record that you are inserting? 7- Is the table is closed while inserting the new records? Regards, Abdulaziz Jasser |
![]() |
| Thread Tools | |
| Display Modes | |
|
|