我在程序中有这样的一句:
update ac_Record set
ac_record.EnterTime = (SELECT Min(inTime) FROM ent_rec
where (ent_rec.inTime between
ac_record.BeginTIme and ac_record.EndTime)
and (ent_rec.uID = ac_record.staffID)),
ac_record.LeaveTime = (SELECT Max(inTime) FROM ent_rec
where (ent_rec.inTime between
ac_record.BeginTIme and ac_record.EndTime)
and (ent_rec.uID = ac_record.staffID))
FROM ac_record, Ent_Rec
WHERE ac_record.datet between 
'2004-8-3' and '2004-8-2'在我的开发的电脑上一切正常,但装到别的电脑上总是出现执行超时错误,请高手帮忙。
waiting online, thank you very much

解决方案 »

  1.   

    将YTimeOut时间设置长一点看看
      

  2.   

    TO : ljmanage(过客) 
    但在我的电脑上只要几十毫秒就执行玩了的呀
      

  3.   

    将数据库控件如ADOQuery的CommandTimeout设长一点试试如果是超时,应该能解决
      

  4.   


    update as_record set
    ac_record.entertime=b.maxtime,acrecord.leavetime=b.mintime
    from (select uid,max(intime) as maxtime,min(intime) as mintime from 
          ent_rec  where ent_rec.intime between ... and ... ) b
    where a.staffid=b.uid
    and a.datet between...and...
      

  5.   

    我用出错的电脑上装的query analizer执行这个语句也不会出错,几十毫秒就执行玩了,为什么程序里执行不了这个语句?
      

  6.   

    hehe, 是会超时! 二個字段要分別用一個SELECT句、再加上本身的条件...
    建義用存储过程来解決。
      

  7.   

    再说就执行三个SELECT 也不至于超时的
      

  8.   

    ...这是什么道理啊,每种数据库支持的sql语法是不一样的,即使不作过程,换了数据库你的程序也没有多大移植性
      

  9.   

    你用什么方式连的数据库?
    是BDE还是ADO,用的什么接口?
    如果是ADO,升级一下看看
    如果是BDE,建议用Query+UpdateSQL
    你在程序执行的时间用监视器跟踪一下,看看执行的是直接的语句还是加了一大堆的动作
      

  10.   

    一)対UPDATE自身的条件句↓、要控制条件、一次不要選中太多的記録。
      WHERE ac_record.datet between '2004-8-3' and '2004-8-2'二)対字段付値的条件句↓
       where (ent_rec.inTime between ac_record.BeginTIme and ac_record.EndTime)
         and (ent_rec.uID = ac_record.staffID) 建義対表「ent_rec」建索引文件、可加速捜査。
      CREATE INDEX yourIndex ON ent_rec (inTime, uID)
      

  11.   

    jinjazz好像在软件工程模块活动的吧?