BCB 插入大量数据到数据库时出现程序崩溃
RT,数据量超过2w条时会有这种现象,直接死掉。每条记录插入的字段为38个。
执行步骤如下:
ADOQuery1->Close();
ADOQuery1->SQL->Text = "alter table "+Trim(ComboBox1->Text)+" add id counter ";
try{ADOQuery1->ExecSQL();}
catch(Exception& e){}
ADOQuery1->Close();
ADOQuery1->SQL->Text = "create index ss on "+Trim(ComboBox1->Text)+"(id) ";
try{ADOQuery1->ExecSQL();}
catch(Exception& e){}
ADOQuery1->Close();
ADOQuery1->SQL->Text = "select id from "+Trim(ComboBox1->Text);
try{ADOQuery1->Open();}
catch(Exception& e)
{ }
int recordCount = ADOQuery1->RecordCount;
ProgressBar1->Max = recordCount;
ADOQuery2->Close();
ADOQuery2->SQL->Text = "insert into dbo.NFavorites(userid,repid,cataid,inserttime,updatatime,seeable,dispOrder,doctypeNum,doctypeName,enterusername,checkusername,checkstate,checknote,"+tableStr+" fulltext,dxid,datatype,annexurl,imgurl,videourl,sufulltext) values(1,1,"+cataid+",'"+time+"','"+time+"',1,NULL,'"+num+"','"+name+"','"+user+"',NULL,'"+checkstate+"',NULL,"+valueStr+"'"+fulltext+"','"+dxid+"','0','"+annexurlVal+"','"+imgurlVal+"','"+videourlVal+"','"+sufulltextVal+"')" ;
try{ADOQuery2->ExecSQL();}