Re: transaction and open table



"Ryan Liu" <RyanLiu_99@xxxxxxxxx> wrote in message news:eloYgRotHHA.1184@xxxxxxxxxxxxxxxxxxxxxxx
I have few db write and read to execute, so I use transaction.

Is that a problem or is that a regular way that I only use transaction on
some cmds only, and other cmds I do not use trasaction, esp those read
actions, or even use another dbconnection to read?

It depends on what you are trying to accomplish. If the transaction is properly isolated (which you control through the transaction isolation level), then those commands that you execute outside of the transaction will not see the changes that you have done inside the transaction until the transaction is committed. This may or may not be what you want to happen.
Moreover, since the transaction will place locks on the database to accomplish the isolation, depending on what you are doing you risk that the database commands that you are executing outside of the transaction might get blocked waiting for the transaction to finish. You certainly don't want this to happen, because the blocked command would stop your program from proceeding to complete the transaction, and therefore would never get unblocked.


BTW, what does "open table" menas? Is that table only be "open" when someone
read or write it. Once all user finish read or write the db table, the
table should be "closed", is that right?

If you are sending Sql commands to a database, then the tables are not 'open' or 'closed'. They simply get some locks placed upon them when they are accessed inside a transaction, and the locks are removed when the transaction completes. This is automatic, and you don't have to do anything special for it to happen.

.



Relevant Pages

  • Re: Transaction.Commit() and Transaction.Rollback()
    ... They are used to ensure that an entire group of commands succeeds or else none of them succeed. ... This is done through the use of a transaction log. ... The Begin Transaction, Commit Transaction, End Transaction & Rollback Transaction commands are ways to specify which groups of queries to treat as Atomic. ... Commit & End Transaction tells the database that your are finished with that atomic operation and that all the commands you had sent since the trasaction began should now get committed to the actual database tables. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Transaction Identifier in transaction replication
    ... Sql server shows the value of the transaction id when we execute following two commands: ... I need to read this value in custom stored procedure of subscribed database. ... In your case you can't modify the source app, ...
    (microsoft.public.sqlserver.replication)
  • Re: Multiple concurrent isolated transactions on ADO Dataset
    ... and an allocation is too great to warrant one short transaction, also, there ... > transaction and view should be updated after it. ... The commands are stacked up ... >> database transaction which succeeds or fails. ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: dbf trashing problem after upgrade
    ... FLUSH doesn't work on disks that have an active Write cache, ... Tha'ts why VFP in recent versions has added commands like SYS'Purge ... data modifications or as the BEGIN TRANSACTION - END TRANSACTION / ROLLBACK ... the terminals share a DBF on the server. ...
    (microsoft.public.fox.programmer.exchange)
  • Re: dbf trashing problem after upgrade
    ... i will do some testing with the commands you mentioned and let you know of ... > Hi Anis ... > FLUSH doesn't work on disks that have an active Write cache, ... > data modifications or as the BEGIN TRANSACTION - END TRANSACTION / ...
    (microsoft.public.fox.programmer.exchange)