473,767 Members | 2,166 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

TransactionScop e Error

RP
I tried following code but it generates error at line (using .....):

Error 23 The type or namespace name 'TransactionSco pe' could
not be
found (are you missing a using directive or an assembly reference?)

===[code]=============== =============== ==========

private void cmdProceed_Clic k(object sender, EventArgs e)
{
using (TransactionSco pe scope = new TransactionScop e())
{
GenerateAll();

// Commit the transaction.
scope.Complete( );
}

}
=============== =============== =============== ====

Oct 12 '07 #1
5 8641
On Oct 12, 8:15 am, RP <rpk.gene...@gm ail.comwrote:
I tried following code but it generates error at line (using .....):

Error 23 The type or namespace name 'TransactionSco pe' could
not be found (are you missing a using directive or an assembly reference?)
Well, the error message is fairly clear: you're missing a using
directive or assembly reference. TransactionScop e is in the
System.Transact ions namespace, in the
System.Transact ions.dll assembly.

Jon

Oct 12 '07 #2
RP
When I type System. , I cannot see anything like Transactions. It
does not appear in the list.
On Oct 12, 12:21 pm, "Jon Skeet [C# MVP]" <sk...@pobox.co mwrote:
On Oct 12, 8:15 am, RP <rpk.gene...@gm ail.comwrote:
I tried following code but it generates error at line (using .....):
Error 23 The type or namespace name 'TransactionSco pe' could
not be found (are you missing a using directive or an assembly reference?)

Well, the error message is fairly clear: you're missing a using
directive or assembly reference. TransactionScop e is in the
System.Transact ions namespace, in the
System.Transact ions.dll assembly.

Jon

Oct 12 '07 #3
RP
I also want to know how is TransactionScop e different from the old
SQLTransaction. Secondly, while using TransactionScop e, how to
determine whether the transaction was successful or not.

Oct 12 '07 #4
On Oct 12, 8:32 am, RP <rpk.gene...@gm ail.comwrote:
When I type System. , I cannot see anything like Transactions. It
does not appear in the list.
And that suggests that you haven't referenced the
System.Transact ions.dll assembly.

Jon

Oct 12 '07 #5
On Oct 12, 8:41 am, RP <rpk.gene...@gm ail.comwrote:
I also want to know how is TransactionScop e different from the old
SQLTransaction.
Well it's not tied to SQL Server, to start with... it's a more general
transaction mechanism.
Secondly, while using TransactionScop e, how to
determine whether the transaction was successful or not.
The docs aren't terribly clear, but it looks like you'll get a
TransactionInDo ubtException if the commit fails.

Jon

Oct 12 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2055
by: Rick_Kierner | last post by:
I am attempting to use the TransactionScope class to manage my transactions. I am running into an issue. My web server is in an NT work group. My SQL Server is in a domain. When my code attempts to execute the Complete method of the TransactionScope object, I get the following error: "The transaction has already been implicitly or explicitly committed or aborted" I have tried altering the registry entry to...
3
7123
by: OUSoonerTaz | last post by:
We are randomly getting this error message on our development and staging machines: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.; at System.Data.Common.UnsafeNativeMethods.OraMTSJoinTxn(OciEnlistContext pCtxt, IDtcTransaction pTrans) at System.Data.OracleClient.TracedNativeMethods.OraMTSJoinTxn(OciEnlistContext pCtxt, IDtcTransaction pTrans)
6
1776
by: Mukesh | last post by:
Hi, I am new to 2.0 framework. I am trying to use TransactionScope in the following code. I took four lables. Started TransactionScope scope. After setting values to three labels I throw an exception. I expexted all label value would remain as method Complete() of TransactionScope scope was not complete. But actually three labels are showing new values. label1.Text="1";
3
7724
by: kikapu | last post by:
Hi to all folks, i am trying to understand the use of System.Transactions in general and TransactionScope particularly. What am i allowed to do in a using statement that wraps a TransactionScope object, so this to be rollback in case of an exception or when i do not call scope.complete ?? I mean, can i set an object's variables and then un-done these sets
0
1442
by: RP | last post by:
I have a two classes, first named "ModCon" has procedures written for connections and the second named "ModRes" contains functions and procedures that can be reused. For my question it is important to add sample codes of the two classes and later the code from a Form's button click event which is giving problem. ======================================== public string ConString; public SqlConnection myCN = new SqlConnection();
3
8028
by: Aleksey Timonin | last post by:
Hi guys, I tried to use TransactionScope on to defferent TableAdapters like this: using (TransactionScope transScope = new TransactionScope(TransactionScopeOption.Required)) { TableAdapter1.InsertQuery(id, name); TableAdapter2.InsertQuery(id, customerName, customerAddress); transScope.Complete(); }
3
2897
by: Michael Schöller | last post by:
Hello, First of all english is not my natural language so please fogive me some bad mistakes in gramatic and use of some vocables :). I have a great problem here. Well I will not use it anymore but I want to know why it is as it is ^^. I tried with .NET3.0 but I think it will be the same with 2.0 and 3.5. MSDTC is configured and working.
0
3240
by: Svein Terje Gaup | last post by:
Hi, I have some code on .NET 2.0 that creates a TransactionScope and then tries to open a SQL Connection. When I try to open the connection, I get this error: Test method CDNDWUnitTestsNet.CDNDWFacadesNet_DealerAdminTest.DeleteDealerTest threw exception: System.Transactions.TransactionException: The operation is not valid for the state of the transaction.. Stack trace:
2
2636
by: GaryDean | last post by:
When I use transactions with sql server I usually do this... using (TransactionScope scope = new TransactionScope) { using (SqlConnection1 = new SqlConnection . . . . . and this all works great. But now, I need to stretch the transaction across to sql databases using two different connections i.e. using (TransactionScope scope = new TransactionScope) {
0
9404
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10168
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
10009
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...
1
9959
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8835
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...
1
7381
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6651
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5423
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
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.