Say I run the following code in SQL Studio Manager:
begin transaction
update Person set Name='Ian' where id=1
I then close SQL studio manager and I see the following warning:
There are uncommitted transactions. Do you wish to commit these transactions before closing the window?
If I select yes, then the transaction is committed. If I select no then it is rolled back.
How does this work with a VB6/.NET program? Say I have code that causes an error/exception and the transaction is neither committed nor rolled back (like it should be). Does the transaction remain active indefinitely or is there a time limit? Is the transaction committed or rolled back?
Update I have written a VB6 program, which:
1) Establishes a connection to a database
2) Executes the following SQL statement inside a serialized transaction: UPDATE Person SET Name='Ian' WHERE ID=1 (Name changed from Ian)
3) Throw an error and close application without committing nor rolling back the transaction
I then open SQL studio manager and execute the following statement:
select * from person where id=1
SQL Studio hangs i.e. it does not return a result. I then run steps 1-3 again, this time rolling back the transaction properly. The program completes successfully i.e. the row is not locked for the VB6 client. I am then able to run the SELECT statement in SQL Studio Manager (it returns a result):
select * from person where id=1
Does the connection pool keep the transaction open?