Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

need procedure to enter 50000 records in DB table...

Status
Not open for further replies.

strucnjak79

Programmer
Oct 14, 2005
37
BA
Well I need to fill my DB to test speed...
So I need procedure to do it! I made a loop, TADOQuery.... Well problem is, after first record is entered in database I got message 'CommandText does not return a result set' and I'm out of loop...

Here is some code...


for i:=1 to 50000 do
begin
qry.active := false;
no_page:=IntToStr(i); // I have one unique field....
qry.SQL.Add ('INSERT INTO tblRegTR ( ...fields...);
qry.SQL.Add ('VALUES ( ...values...');
qry.active := true;
end;




How to override this? Am I doing something wrong? Any idea?

Also, which is a key for this sign ' if I know that '/' is #c5?
 
Code:
for i:=1 to 50000 do
begin
qry.active := false;
[b]qry.SQL.Clear;[/b]
no_page:=IntToStr(i); // I have one unique field....
qry.SQL.Add ('INSERT INTO tblRegTR ( ...fields...);
qry.SQL.Add ('VALUES ( ...values...');
qry.active := true;
end;

Leslie

Anything worth doing is a lot more difficult than it's worth - Unknown Induhvidual

Essential reading for anyone working with databases: The Fundamentals of Relational Database Design
 
Well yes I miss that clear part, tnx! But I have same problem, 'CommandText does not return a result set' so it enter only one row in DB table...


SO plz help!!!
 
it's

EXECSQL

for INSERT, UPDATE and DELETE queries, not ACTIVE.

Try this:

Code:
for i:=1 to 50000 do
begin
qry.active := false;
qry.SQL.Clear;
no_page:=IntToStr(i); // I have one unique field....
qry.SQL.Add ('INSERT INTO tblRegTR ( ...fields...);
qry.SQL.Add ('VALUES ( ...values...');
qry.ExecSQL;
end;

 
Well thanks! Since I'm total beginner with Delphi (prefer c++ :) I made a mistake (or maby it's not, I didn't realy try your way) I used ADOQuery insread of ADOCommand component...
 
Why not using a good'n'old dataset?

buho (A).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top