用存储过程来实现事务,就不会有你的那种问题了。
for example:
create procedure ***
(
@ID int
)
as
begin transaction
select * from tablename where tableID=@ID
commit transaction
for example:
create procedure ***
(
@ID int
)
as
begin transaction
select * from tablename where tableID=@ID
commit transaction
一般是先执行SQL语句以后才提交事务
应该是先con.begintransaction,然后tra.commit
你试一试
(数据库是SQL Server2000)