Is it bad to use transactions for read operations (keeps conn. ope

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi I am trying to find out if it is bad, and how bad, to start a database
transaction on a set of read operations. By starting a transaction I can
keep open the database connection...but is there significant overhead for
transaction?

Basically I am populating a set of objects and I may hit the database 5 to
10 times on any given set of parent/child objects.

I cannot use stored procedures.

What do you think?
 
Transactions are meant for insert/update/delete operations (not for
read)

if you want to keep the same connection for whatever reason, then use
sqldatareader class (assuming you are using sql server). Remember to
close the connection when you exit the program or when it an error
occurs.
 
I think that you are wrong.
Transactions are/can be used for read operations within a database.

You have Serializable and Repeatable Read type of isolation level for a
Transaction.

So, transactions do/can make an impact on how data is read.
 
Back
Top