Questions tagged [sqltransaction]

An SQL-transaction is a unit of work that is performed against a database. Transactions are units or sequences of work accomplished in a logical order. Executing SQL-statements in Transactions, can ensure data integrity and handle database errors.

An SQL-transaction is a unit of work that is performed against a database. Transactions are units or sequences of work accomplished in a logical order.

A transaction is the propagation of one or more changes to the database. For example, creating, updating, or deleting a record from the table. Transactions are used to ensure data integrity and to handle database errors, by collecting SQL queries into a group and executing all of them together, as one unit of work.

Properties of Transactions: Transactions have the following four standard properties, usually referred to by the acronym ACID:

  • Atomicity: ensures that all operations within the work unit are completed successfully; otherwise, the transaction is aborted at the point of failure, and previous operations are rolled back to their former state.
  • Consistency: ensures that the database properly changes states upon a successfully committed transaction.
  • Isolation: enables transactions to operate independently of and transparent to each other.
  • Durability: ensures that the result or effect of a committed transaction persists in case of a system failure.
233 questions
0
votes
1 answer

SQL Server Broker Transaction Completed on Poison Message Exception

I am using SQL Server Broker in 2008 R2 in a C# application and am trying to handle the case where SQL Server has detected a poison message and has disabled the target queue. When this case occurs, an SqlException is thrown when I'm trying to…
FodderZone
  • 863
  • 12
  • 27
0
votes
1 answer

How to wait for SqlTransaction to commit instead of throwing SqlException

I am trying to develop an application of inventory management, and for the moment I am trying to do a proof of concept of adding/removing items with transactions. The site will be hosted on Windows Azure so I have to use SqlTransation to perform…
Elmcherqui
  • 55
  • 7
0
votes
1 answer

SQLTransaction does not work in c#

I have opened transaction inside one function ,this function calls stored procedure,which updates data in SqlDataTable.After i return from this function without rollback or commit and call other function, which must return data from same…
0
votes
0 answers

Why SqlTransaction is fast with ado.net using C#?

I'm working on an asp.net web application project. I tried the same operation with SqlTransaction and without SqlTransaction. Execution time of code which is using SqlTransaction is faster than that which is not using SqlTransaction. I want to know…
Brijraj
  • 177
  • 2
  • 3
  • 13
0
votes
1 answer

SQLTransaction Multiadd response redirect not working

I am using transaction to add diffrent database tables. When ı add Response.redirect(""); I am getting the error : SQLTransaction complete; is no longer available. If ı delete the response.redirect, It is working fine without the error. protected…
user3630521
  • 35
  • 1
  • 11
0
votes
3 answers

SQL Transaction with C#

I have C# windows application.When 'Button 1' click in 'Form 1' I have a process that written data to few tables. That process normally taking 10 minutes. When one user click that 'Button 1' , another user who using same DB and program clicking…
Tom
  • 1,343
  • 1
  • 18
  • 37
0
votes
1 answer

BeginTransaction() on sqltransaction freezes, how to use try catch to solve it?

I'm using SqlTransaction transaction = connection.BeginTransaction() in my C# application to get data from SQLServer. The problem I have when there is no connection to server (no internet connection), then my application just freezes and stops…
0
votes
0 answers

SQL transaction with multiple tables

I have three tables, DISTRIBUTION_LIST, USERS, and ADDRESSES. Single object 'distribution_list' has multiple users and addresses. I want to create transaction which will write to those three table together and FOREIGN_KEY in tables USERS and…
Anatoly
  • 5,056
  • 9
  • 62
  • 136
0
votes
1 answer

Unexpected sql operation order in Rails controller action

We have an action that returns a dynamic list of user emails that are due for a monthly newsletter. The action takes an optional mark_as_sent parameter, which if present will update the user records to show they were sent an email today. But even…
Yarin
  • 173,523
  • 149
  • 402
  • 512
0
votes
1 answer

T-SQL lock resouce in an event of concurrent access

I want to lock a certain table in the event of concurrent access. Inside a stored procedure: I truncate a table Do calculations and populate the above table After returning from PROCEDURE, do a select from the table To avoid issues in event of…
Sujit Prabhakaran
  • 295
  • 3
  • 12
  • 26
0
votes
2 answers

c# program : Getting error with SQLTransaction commands with lot of INSERT statements

Update 1: The below code works fine on my DEV machine but fails on TEST/Production server. public TransImport() { ConnString = ConfigurationManager.ConnectionStrings["Connection"].ConnectionString; SqlConnection conn_new; SqlCommand…
Anirudh
  • 581
  • 5
  • 14
  • 32
0
votes
4 answers

Getting timeout errors with SqlTransaction on same table

public TransImport() { ConnString = ConfigurationManager.ConnectionStrings["Connection"].ConnectionString; SqlConnection conn_new; SqlCommand command_serial_new; SqlConnection conn; SqlCommand command_serial; …
Anirudh
  • 581
  • 5
  • 14
  • 32
0
votes
0 answers

SQL transaction wrapper disposing

I'm trying to encapsulate transaction handling in C# code. To achieve this I created a class called TransactionProvider. public class TransactionProvider : IDisposable { public SqlTransaction Transaction { get; private set; } private…
borkovski
  • 938
  • 8
  • 12
0
votes
1 answer

MS SQL - reading multiple tables in C# atomically

Imagine, there is a program, written in C#, in which there is an object (A) which references 2 sets of objects ( set of B, set of C). These objects are stored in MS SQL as rows in TableA, TableB, TableC where TableA has a field ID_Of_B referencing…
programming idiot
  • 145
  • 1
  • 2
  • 13
0
votes
1 answer

PHP + MySQL - transactions dont rollback

I am using old-style mysql_query() functions to perform a transaction. It is not rolling back even though one of the queries in the transaction has failed. I have debugged affected rows and they are either 0 or 1. Syntax followed: $cnx =…
dr_rk
  • 4,395
  • 13
  • 48
  • 74