473,765 Members | 2,024 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to set Transaction scope in c#?

1 New Member
I have c# code something like below.
Expand|Select|Wrap|Line Numbers
  1.  
  2. void ExecuteSomething()
  3.     TransactionOptions transactionOptions = new TransactionOptions();
  4.   transactionOptions.IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted;
  5.   transactionOptions.Timeout = TimeSpan.FromSeconds(TransactionTimeOutInSeconds);
  6.  
  7.   using (TransactionScope transactionScope = new TransactionScope(TransactionScopeOption.Required, transactionOptions))
  8.   {
  9.       action();
  10.       transactionScope.Complete();
  11.   }
  12. }
  13.  
  14.  
i am retrieving the data by using above code

From some other code i am calling some function in c# through windows service. That function is going to delete some unwanted data from sql server database. if i wanted i initiate the request it will take 30 min to delete the data.

in this 30 min time i am unable to access other pages in my website. is there any better way to design this?
Jul 2 '12 #1
2 2935
Plater
7,872 Recognized Expert Expert
So this is being done on the webserver? Hmm I think you can still use threads right?
I have never done it, but long running tasks like are usually implimented in a way where you have a unique token that references the "job" and you can keep refreshing the page to find out if it is complete.
You could look up ways to handle that sort of thing, there might be a good explanation of it somewhere
Jul 2 '12 #2
frenchmarlohe
1 New Member
Get the current value of the first element in the set of matched elements.You need to specify in the script which field you want to use as an input field. Assuming it's HORAS2, then the script will be och.
http://dapfor.com/en/net-suite/net-g...ial/data-types
Aug 17 '12 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
1335
by: mukesh | last post by:
Hi, Suppose I have four different functions. All four update four different tables. I want to execute these functions in a transaction. TRANSACTION START CALL A=FUNCTION1() CALL B=FUNCTION2() CALL C=FUNCTION3() CALL D=FUNCTION4() TRANSACTION END
4
1790
by: liming | last post by:
Hi, I know it's possible to have transactions with Typed DataSet, but I have yet to find an example of it. For example, I have two typed TableAdapter CommerceDataSet.xsd CustomerTableAdapater
2
17872
by: Martin Z | last post by:
I'm using the TableAdapterHelper to set the connection and transaction properties on all the commands of all my typed table adapters.... I've checked at the time of the error and all the commands have their Transaction property set. But I still get this error when I call... documentTA.Update(documentDS.Document); "ExecuteReader requires the command to have a transaction when the connection assigned to the command is in a pending local...
5
7409
by: Allan Ebdrup | last post by:
I'm using dotNet 2.0 and System.Transactions to run transactions that span multiple database queries, Now I would like to log any Sql errors that occur in the transaction, but when I insert the logentry into the database the query that does the inserting is automatically enlisted in the running transaction and rolled back when the transaction aborts. How do I run the query inserting into the log outside the current transaction, so that it...
3
2044
by: GaryDean | last post by:
I'm using TransactionScope as follows... using TransactionScope myScope = new TransactionScope()) { using (SqlConnection conn = new SqlConnection()) { conn.ConnectionString = GlobalData.connString; conn.Open(); ...................code that does db work myScope.Complete();
2
1748
by: cmrhema | last post by:
Hello I am trying to run a program to check for transaction scope I have written the following code. But it seems I need to add a namespace or reference What namespace am I supposed to add thanks using (TransactionScope scope = new TransactionScope(TransactionScope.Required, options))
0
1548
by: =?Utf-8?B?Sm9l?= | last post by:
Very weird; I lost a day worth of work because of this problem. I have an ASP.NET application written in VB that is using MySQL database. Shortly, a page creates a Customer record in the database and if successful, creates a directory on the web server. I was using Transaction Scope to accomplish this action; here is the code excerpt: ' Initialize the return value to zero Dim returnValue As Integer = 0
1
1188
by: Randa | last post by:
I'm Using Transaction Scope to implement a transaction against SQL Server 2000. Locally its working Perfectly and no problem happens; but when trying to do the same action on a remote server it dosn't work; it gives no errors or exception just doesn't rollback when an exception appears before Completion. The server's DTC Service is working, and no firewall is installed at the SQl Server machine Does anyone know what may be the reason for...
2
2615
by: RP | last post by:
I have a code like this: ========================================== private void cmdProceed_Click(object sender, EventArgs e) { GenerateAll(); } ========================================== I want to initialize transaction object just before GenerateAll(). The
4
3672
by: Aamir Mahmood | last post by:
Hi I am using System.Transactions.TransactionScope to implement the transactions in my code. When the transaction is rolled back because of any reason, I want all the objects that were modified in the transaction scope to be in their initial (pre-transaction) state. Is there something already available in .net? Or some standard approach I
0
9568
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10163
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10007
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9835
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8832
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5423
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3924
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3532
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2806
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.