Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > DB-Aware

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
Old 12-13-2008, 03:26 AM
baykus baykus is offline
Junior Member
 
Join Date: Mar 2006
Posts: 15
Default out of memory problem (access DB)

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 . . .
Reply With Quote
  #2  
Old 12-13-2008, 05:50 AM
Jasser Jasser is offline
Moderator
 
Join Date: Jan 2005
Location: Saudi Arabia
Posts: 4,764
Default RE: out of memory problem (access DB)

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
Reply With Quote
  #3  
Old 12-14-2008, 09:51 PM
baykus baykus is offline
Junior Member
 
Join Date: Mar 2006
Posts: 15
Default RE: out of memory problem (access DB)

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]
Reply With Quote
  #4  
Old 12-16-2008, 10:06 AM
Jasser Jasser is offline
Moderator
 
Join Date: Jan 2005
Location: Saudi Arabia
Posts: 4,764
Default RE: out of memory problem (access DB)

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
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 05:06 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.