473,750 Members | 2,253 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 8639
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
7120
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
1773
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
7721
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
1439
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
8026
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
2896
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
3236
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
2635
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
8999
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
9256
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
8260
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
6803
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
6080
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
4712
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4885
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3322
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
2798
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.