我有两张表(student表、accounts表),我对student表中部分记录的student_money增加金额,同时,增加金额的记录同时加入到accounts表中,程序如下,但执行的速度相当慢,如何解决?
while not mydb.ADOTable_student.Eof do
begin
mydb.ADOTable_student.Edit;
mydb.ADOTable_student.FieldByName('student_money').AsFloat:=mydb.ADOTable_student.FieldByName('student_money').AsFloat+strtofloat(student_money.Text)*money;
mydb.ADOTable_student.Post;
mydb.ADOTable_student.Refresh; mydb.ADOTable_accounts.Insert;
mydb.ADOTable_accounts.fieldbyname('student_card').Asstring:=mydb.ADOTable_student.fieldbyname('student_card').AsString;
mydb.ADOTable_accounts.FieldByName('student_money').AsFloat:=strtofloat(student_money.Text)*money;
mydb.ADOTable_accounts.FieldByName('money_about').AsString:=Money_about;
mydb.ADOTable_accounts.FieldByName('sys_name').AsString:='sys';
mydb.ADOTable_accounts.post;
mydb.ADOTable_accounts.refresh; mydb.ADOTable_student.Next;
end;
while not mydb.ADOTable_student.Eof do
begin
mydb.ADOTable_student.Edit;
mydb.ADOTable_student.FieldByName('student_money').AsFloat:=mydb.ADOTable_student.FieldByName('student_money').AsFloat+strtofloat(student_money.Text)*money;
mydb.ADOTable_student.Post;
mydb.ADOTable_student.Refresh; mydb.ADOTable_accounts.Insert;
mydb.ADOTable_accounts.fieldbyname('student_card').Asstring:=mydb.ADOTable_student.fieldbyname('student_card').AsString;
mydb.ADOTable_accounts.FieldByName('student_money').AsFloat:=strtofloat(student_money.Text)*money;
mydb.ADOTable_accounts.FieldByName('money_about').AsString:=Money_about;
mydb.ADOTable_accounts.FieldByName('sys_name').AsString:='sys';
mydb.ADOTable_accounts.post;
mydb.ADOTable_accounts.refresh; mydb.ADOTable_student.Next;
end;
解决方案 »
- PrintWindow函数可以在WIN7下后台截取DX游戏图片吗?
- midas 怎样获得服务器对象
- 无解:字段的删除与添加
- 请教:Delphi 6中调用VB写的dll组件,怎么报错呢?
- 请教高手,如何使用winapi函数结束系统中的explorer进程,该问题在其他版块都无人能解决,
- 小弟刚接触3层不久,哪位大虾可以给我一些范例???
- 有无稍稍懂法的?我跟公司签定了劳工合同,但是都半年了公司还没把一式三份的劳工合同给我,请问这合同有效吗?
- Tolecontainer的使用(急!!!!!!!!)
- RxRichEdit的问题
- :◆◇◆◇◆◇对CSDN各网友严重警告◇◆◇◆◇◆--------------Delphi版块
- 抽到一等奖,买一件西服送音箱+功放+VCD,该不该去买?会不会有诈?帮我看看
- 帮帮我啊。我在等..
mydb.ADOTable_accounts.DisalbeControls;mydb.ADOTable_student.Edit;
while not mydb.ADOTable_student.Eof do
begin
mydb.ADOTable_student.FieldByName('student_money').AsFloat:=mydb.ADOTable_student.FieldByName('student_money').AsFloat+strtofloat(student_money.Text)*money;
mydb.ADOTable_student.Post; mydb.ADOTable_accounts.Insert;
mydb.ADOTable_accounts.fieldbyname('student_card').Asstring:=mydb.ADOTable_student.fieldbyname('student_card').AsString;
mydb.ADOTable_accounts.FieldByName('student_money').AsFloat:=strtofloat(student_money.Text)*money;
mydb.ADOTable_accounts.FieldByName('money_about').AsString:=Money_about;
mydb.ADOTable_accounts.FieldByName('sys_name').AsString:='sys';
mydb.ADOTable_accounts.post; mydb.ADOTable_student.Next;
end;
enableControls;
adotable_student.enableControls;
mydb.ADOTable_accounts.enableControls;
enableControls;
数据库的STUDENT表作个触发器呀....碰到Modify时候触发修改account表..
速度又快.也省事..