做了一个小程序,就是执行一个数据库的更新操作,sql语句如下
update t2 set iTVACost=t3.price,iTVAPrice=t3.price*t2.iTVQuantity from TransVouch t1 inner join TransVouchs t2 on t1.id=t2.id
inner join UFSystem..UA_Period t5 on t5.iYear=Convert(char(4),t1.dTVDate,111) and t5.cAcc_Id='009' and t1.dTVDate between t5.dBegin and t5.dEnd
inner join (select iMonth,cInvCode, case when (sum(IsNull(期初数量,0))+sum(IsNUll(本期入库数量,0)))<>0 then (sum(IsNull(期初金额,0))+sum(IsNUll(本期入库金额,0)))/(sum(IsNull(期初数量,0))+sum(IsNUll(本期入库数量,0))) else 0 end as price
from (select 10 as iMonth,cInvCode,iNum 期初数量,iMoney 期初金额,0 本期入库数量,0 本期入库金额 from IA_Summary where iMonth= 10-1
union select iMonth,cInvCode,0 期初数量,0 期初金额, sum(IsNull(iAInQuantity,0)) 本期入库数量,sum(IsNull(iAInPrice,0)) 本期入库金额 from IA_Subsidiary where iMonth= 10 group by iMonth,cInvCode
) a group by iMonth,cInvCode )t3 on t3.iMonth=t5.iId and t3.cInvCode=t2.cInvCode where t3.iMonth= 10此sql语句经验证,没有问题,在查询分析器中执行更新了2480个记录需要2分钟,
但是我用程序写在vs2008中,连接数据库却出现超时错误,告诉我超时,经验证发现,数据库连接已经打开。
我是用事务控制的,数据库是sql 2000,请问有什么问题吗,谢谢啊,呵呵
update t2 set iTVACost=t3.price,iTVAPrice=t3.price*t2.iTVQuantity from TransVouch t1 inner join TransVouchs t2 on t1.id=t2.id
inner join UFSystem..UA_Period t5 on t5.iYear=Convert(char(4),t1.dTVDate,111) and t5.cAcc_Id='009' and t1.dTVDate between t5.dBegin and t5.dEnd
inner join (select iMonth,cInvCode, case when (sum(IsNull(期初数量,0))+sum(IsNUll(本期入库数量,0)))<>0 then (sum(IsNull(期初金额,0))+sum(IsNUll(本期入库金额,0)))/(sum(IsNull(期初数量,0))+sum(IsNUll(本期入库数量,0))) else 0 end as price
from (select 10 as iMonth,cInvCode,iNum 期初数量,iMoney 期初金额,0 本期入库数量,0 本期入库金额 from IA_Summary where iMonth= 10-1
union select iMonth,cInvCode,0 期初数量,0 期初金额, sum(IsNull(iAInQuantity,0)) 本期入库数量,sum(IsNull(iAInPrice,0)) 本期入库金额 from IA_Subsidiary where iMonth= 10 group by iMonth,cInvCode
) a group by iMonth,cInvCode )t3 on t3.iMonth=t5.iId and t3.cInvCode=t2.cInvCode where t3.iMonth= 10此sql语句经验证,没有问题,在查询分析器中执行更新了2480个记录需要2分钟,
但是我用程序写在vs2008中,连接数据库却出现超时错误,告诉我超时,经验证发现,数据库连接已经打开。
我是用事务控制的,数据库是sql 2000,请问有什么问题吗,谢谢啊,呵呵
另外,我查了一下,Command.CommandTimeout这个应该如何用呢?
Command.CommandTimeout=(秒数)
为什么我连接2k和2k5都好使,但是连接2k8的时候就不行呢?