吴
吴剑明
Unregistered / Unconfirmed
GUEST, unregistred user!
为何会死锁? 这样的程序如何写啊?? 急,老板半小时后看程序!!!<font size=10 color=red>救命</font> (100分)<br />先分别SELECT A表和B 表,加了NOLOCK参数,一加 StartTransaction就死,不加则没事
try
begin
DM_2000.Db_mis.StartTransaction; 加了这个就死
with DM_2000.wQry_UpStrore do
begin
close;
插入到B表中
execsql;
end;
with DM_lib.wQry_upchange do
begin
close;
修改A表,扣库存
if rowsAffected = 0 then
showmessage('&Icirc;&acute;&Auml;&Uuml;&iquest;&Ucirc;&sup3;&yacute;&sup2;&Ouml;&iquest;&acirc;&iquest;&acirc;&acute;&aelig;&pound;&iexcl;');
end;
DM_2000.Db_mis.commit; 死了
end;
Except on E : exception do
begin
showmessage('&acute;í&Icirc;ó:'+E.message);
DM_2000.Db_mis.rollback;
end;
end;
end;
try
begin
DM_2000.Db_mis.StartTransaction; 加了这个就死
with DM_2000.wQry_UpStrore do
begin
close;
插入到B表中
execsql;
end;
with DM_lib.wQry_upchange do
begin
close;
修改A表,扣库存
if rowsAffected = 0 then
showmessage('&Icirc;&acute;&Auml;&Uuml;&iquest;&Ucirc;&sup3;&yacute;&sup2;&Ouml;&iquest;&acirc;&iquest;&acirc;&acute;&aelig;&pound;&iexcl;');
end;
DM_2000.Db_mis.commit; 死了
end;
Except on E : exception do
begin
showmessage('&acute;í&Icirc;ó:'+E.message);
DM_2000.Db_mis.rollback;
end;
end;
end;