当前位置: 代码迷 >> PB >> 运行后 数据库无法查询了 咋回事?
  详细解决方案

运行后 数据库无法查询了 咋回事?

热度:26   发布时间:2016-04-29 08:33:51.0
运行后 数据库无法查询了 怎么回事???
我运行这段代码后 在查询分析器中执行select * from repair where id=49345 时,显示正在执行批查询 但是就是不出结果,但是把程序一关闭后 查询结果就出来啦


string riqi
riqi=mid(ls_date,3,8)
//sle_1.text=riqi
dw_1.retrieve(riqi)

int i  
string color
for i=1 to dw_1.rowcount()
if dw_1.object.wangong[i] < dw_1.object.daoda[i] then
dw_1.object.wangong[i]=''
end if

if not IsNull(dw_1.object.daoda[i]) and (dw_1.object.wangong[i]='' or IsNull(dw_1.object.wangong[i])) then
dw_1.object.wanmsg[i]=mid(dw_1.object.daomsg[i],7)
dw_1.object.state[i]='0'
elseif not IsNull(dw_1.object.daoda[i]) and not isnull(dw_1.object.wangong[i]) then
dw_1.object.wanmsg[i]=mid(dw_1.object.wanmsg[i],2)
dw_1.object.state[i]='2'
else
dw_1.object.state[i]='1'
end if

long wxid,pgry,test
wxbh=mid(dw_1.object.daomsg[i],2,5)
wxid=long(wxbh)
select id into :test from repair where id=:wxid;
if wxid <> 0 and wxid = test then
long aaa
select khid into :aaa from repair where id=:wxid;
select dwmc ,guester.id into :dwmc,:khid from guester where guester.id=:aaa;
dw_1.object.dwmc[i]=dwmc
dw_1.object.khid[i]=string(khid)
else
dw_1.object.dwmc[i]=''
dw_1.object.khid[i]=''
CONTINUE
end if

string pgy_replace,tel1,msg,ismsg
long send_ms
if dw_1.object.wangong[i]<>"" or not isnull(dw_1.object.wangong[i]) then
select pgy_replace,send_ms into :pgy_replace,:send_ms from repair where id=:wxid;
if not isnull(pgy_replace) and send_ms=0 then
select tel1 into :tel1 from txl where name=:pgy_replace;
msg=dw_1.object.dwmc[i]+"/"+"完工/"+dw_1.object.wanmsg[i]
insert into outbox (mbno,msg) values (:tel1,:msg); 
select msg into :ismsg from outbox where (msg=:msg);
if trim(ismsg)<>"" then
update repair set send_ms=1 where id=:wxid;
setNull(msg)

end if

end if
end if

next

------解决方案--------------------
commit;
循环结束后,加commit;提交,要不然锁表。

------解决方案--------------------
你用一系列sql语句把表锁住了,适时对事务进行提交·
  相关解决方案