473,378 Members | 1,380 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Transaction object

RP
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
GenerateAll procedure contains all the SQL statements, but I want to
set the transaction object before GenerateAll.

Oct 11 '07 #1
2 2600
RP,

So what's stopping you from doing this:

private void cmdProceed_Click(object sender, EventArgs e)
{
using (TransactionScope scope = new TransactionScope())
{
GenerateAll();

// Commit the transaction.
scope.Complete();
}
}
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"RP" <rp*********@gmail.comwrote in message
news:11**********************@o80g2000hse.googlegr oups.com...
>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
GenerateAll procedure contains all the SQL statements, but I want to
set the transaction object before GenerateAll.

Oct 11 '07 #2
RP
But it is giving error:

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

What reference or initialization need to be done?

On Oct 11, 7:35 pm, "Nicholas Paldino [.NET/C# MVP]"
<m...@spam.guard.caspershouse.comwrote:
RP,

So what's stopping you from doing this:

private void cmdProceed_Click(object sender, EventArgs e)
{
using (TransactionScope scope = new TransactionScope())
{
GenerateAll();

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

}
- Nicholas Paldino [.NET/C# MVP]

Oct 11 '07 #3

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

Similar topics

3
by: Alan | last post by:
Gidday people, I had a bit of a problem this morning. I think I've got it sorted now, but I wonder if anyone can shed some light. I have a plain VBS WHS file that instantiates a component that...
2
by: Deepak Mehta | last post by:
i have to update two tables from ASP pages with same data but i want that both of them should be updated at one time. If either of them is not updated then my transaction should roll back.I want...
0
by: DotNetJunkies User | last post by:
I am writing a distributed transaction code. My current scenario include a client database(Suppose client- having 4 main database) which can be installed anywhere which would connect to a public...
4
by: Rahul Anand | last post by:
Getting SQL Exception when trying to implement Connection based Trasaction using SQL Helper class. I am using the follwing function to execute my stored procs: -=-=-=- ExecuteScalar(ByVal...
3
by: Hardy Wang | last post by:
Hi all, I have an application, which requires several SQL activities, so I wrap them in a transaction: SqlConnection conn = new SqlConnection(connectionString); conn.Open(); SqlTransaction tran...
2
by: John Lee | last post by:
Hi, I have few questions related to .NET 2.0 TransactionScope class behavior: 1. Check Transaction.Current.TransactionInformation.DistributedIdentifier to identify if distributed transaction...
1
by: REB | last post by:
If I create a transaction object for rolling back a insert query in the on click event of a form button can the transaction be tracked across other functions? For example: private void...
3
by: GoogleEyeJoe | last post by:
Dear ladies and gents, I'm trying to determine whether the .NET Framework implements a means of transactional processing without the need for a database. Essentially, I'd like to enlist...
0
by: fredd00 | last post by:
Hi i'm using Enterprise Library for .NET Framework 2.0 january 2006 - i really like it but, i have a problem with transactions i'm trying to save 2 object company and user in a transaction (...
0
ADezii
by: ADezii | last post by:
In the Tip of the Week #19, we demonstrated Transaction Processing, specifically as it applies to DAO (Data Access Objects). In this week's Tip, we'll illustrate how Transaction Processing can be...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.