Re: ado.net tricky transaction question

Tech-Archive recommends: Speed Up your PC by fixing your registry

From: David Browne (meat_at_hotmail.com)
Date: 02/15/04


Date: Sun, 15 Feb 2004 11:17:26 -0600


"wrxguru" <wrxguru@iprimus.com-dot-au.no-spam.invalid> wrote in message
news:402f4be6_2@Usenet.com...
> I think I do understand the identity columns and usage however my
> question remains that if I wish to see what has just been inserted
> into the database within a transaction am I able to do this within
> the same transaction ?
>

Yes. You can always see your own changes. However you can only see the
changes inside the same connection. If you are using a second connection
you cannot see the changes.

In Query Analyzer, each window is a seperate connection. If in one window
you run

CREATE TABLE T(I int)
go
begin transaction
insert into t(i) values(1)

and then

select * from T,
you will see the row.

If you run

select * from T
from another window, it will block untill you commit or rollback your
transaction.

BTW this is only the first problem you will encounter generating your own
incrementing keys, so you really should use an Identity column.

David



Relevant Pages

  • Re: Working Transactions somehow started not to work
    ... Transaction and locking are not properties of recordsets but are properties ... Opening a served-based cursor will put a lock on ... If a connection is closed, ... SL> and are not associated necessarily with server-based cursors. ...
    (microsoft.public.access.adp.sqlserver)
  • Re: Locking and Delay in a Bottleneck
    ... of course, in a database, there can be many Identity columns. ... SQL Server MVP ... the saving transaction, this journal voucher is having a header table ... number in a table whereupon you commit. ...
    (microsoft.public.sqlserver.programming)
  • Setting Locks on Rows in MSSQL Database (Currenlty Unsolvable Problem and Trying)
    ... I am beginning a transaction from PHP and setting a lock on a record ... I then commit the transaction I started when the user clicked ... There is no way in PHP where I can start a persistent ms sql connection ...
    (alt.php)
  • Xlocking with a select statement
    ... SQL Server does not honour exclusive row level locking ... set transaction isolation level repeatable read ... This correctly blocks window two as expected. ... Sql server has taken out locks ...
    (microsoft.public.sqlserver.programming)
  • TransactionScope Transactions not commiting
    ... be) using the same SQL Connection. ... and dtermines the Connection String to use to create the connection to ... MyClass obj = new MyClass; ... not involved in a Transaction. ...
    (microsoft.public.dotnet.framework.adonet)