VB调用存储过程报 “超时已过期” 的错误
我写了个存储过程,在VB里调用时,执行到这段就报错啦,提示超时已过期,请各位大侠帮忙,,急,急,急。。。。
-------- 填充数据到明细表
insert into TmpTwoProductions (FDate,FColorName,FLineType,FDayType)
Select Distinct v1.FDate,v1.FColorName,v1.FLineType,v1.FDayType
from TmpTwoHead v1 inner join ICStockBill t1 on (convert(varchar(100),t1.FBDate,23))=v1.FDate
inner join ICStockBillEntry t2 on t2.FInterID=t1.FInterID and t2.FItemID=v1.FItemID AND(t2.FDCStockID=210 or t2.FDCStockID=214)
inner join ICMORptEntry t4 on t4.FInterID=t2.FSourceInterID AND t4.FEntryID=t2.FSourceEntryID and t4.FTeamID=v1.FTeamID
inner join t_Department t5 on t5.FItemID=t1.FDeptID and substring(t5.FName,6,6)=v1.FLineType
inner join ICMO t6 on t6.FInterID=t4.FSourceInterID
[解决办法]
这是程序的问题,查询超时了,把CommandTimeOut设置长一些
cmd.CommandTimeOut=120 '两分钟 180为三分钟
[解决办法]
试试楼上的办法,很有可能是由于你的存储过程执行时间超过了,在vb的连接中的CommandTimeOut属性的值,所以导致报超时的错误。
另外,把你上面的这个语句,单独执行一下,看需要多长时间,如果时间长,可以考虑优化一下,这个才是真正的解决办法:
insert into TmpTwoProductions (FDate,FColorName,FLineType,FDayType)
Select Distinct v1.FDate,v1.FColorName,v1.FLineType,v1.FDayType
from TmpTwoHead v1 inner join ICStockBill t1 on (convert(varchar(100),t1.FBDate,23))=v1.FDate
inner join ICStockBillEntry t2 on t2.FInterID=t1.FInterID and t2.FItemID=v1.FItemID AND(t2.FDCStockID=210 or t2.FDCStockID=214)
inner join ICMORptEntry t4 on t4.FInterID=t2.FSourceInterID AND t4.FEntryID=t2.FSourceEntryID and t4.FTeamID=v1.FTeamID
inner join t_Department t5 on t5.FItemID=t1.FDeptID and substring(t5.FName,6,6)=v1.FLineType
inner join ICMO t6 on t6.FInterID=t4.FSourceInterID