我的程序运行后,是对数据库操作,经常会出现这样的问题:当前一两次执行操作正常后,再执行一次时,程序会突然退出并且没有任何提示信息,真的很烦人,请大仙门帮帮忙
程序调试没有问题,也能运行,只是在运行时,有时会突然退出,特别是当对数据库频繁的操作时就更容易退出,有什么办法能解决吗?能否用ADO解决?我现在用的是ODBC
大家有没有出现过这种情况?如果有,怎么解决的?
例如:
var
  result:boolean;
begin
 try
  result:=true;
  if (product_id.Text='')or(config.Text='') or (cpu.Text='')or(mem.Text='')or(hd.Text='')or(display.Text='') or (cd.Text='') or (fd.Text='') then
   begin
    showmessage('料号或配置和CPU、内存、硬盘、显示屏、光驱、软驱!');
    result:=false;
   end;  if result then
   if config.Text=old_config.Text then
    begin
     showmessage('新配置和原配置相同,不能修改');
     result:=false;
    end;  if result then
   with Qy_productid do
    begin
     close;
     sql.Clear;
     sql.Add(' update turnoff_id set config=:c_fg where product_id=:p_id');
     sql.Add(' update turnoff_actualstate set config=:c_fg ,capacity=:c_fg where product_id=:p_id');
     sql.Add(' update turnoff_config set config=:c_fg where config=:old_cfg');
     sql.Add(' update turnoff_joinbill set capacity=:c_fg where product_id=:p_id');
     sql.Add(' update turnoff_outbill set capacity=:c_fg where product_id=:p_id');
     sql.Add(' update turnoff_table set capacity=:c_fg where product_id=:p_id');
     sql.Add(' update arrange_bill set config=:c_fg where turnoff_id=:p_id');
     parambyname('p_id').AsString:=product_id.Text;
     parambyname('c_fg').AsString:=config.Text;
     parambyname('old_cfg').AsString:=old_config.Text;
     if not prepared then prepare;
     execsql;
     showmessage('[ '+product_id.text+' ]配置修改成功');
     product_id.Text:='';
     product_name2.Text:='';
     old_config.Text:='';
    end;
 except
  showmessage('网络或系统错误');
 end;