Click here to Skip to main content
15,890,690 members
Home / Discussions / C#
   

C#

 
GeneralRe: Solution Found [modified] Pin
Dave Kreskowiak18-Aug-06 11:46
mveDave Kreskowiak18-Aug-06 11:46 
Questionclient server network problem Pin
Kim061818-Aug-06 1:15
Kim061818-Aug-06 1:15 
QuestionBegin-Commit Transaction in .NET Pin
Coding C#18-Aug-06 1:14
Coding C#18-Aug-06 1:14 
AnswerRe: Begin-Commit Transaction in .NET Pin
coolestCoder18-Aug-06 1:24
coolestCoder18-Aug-06 1:24 
JokeRe: Begin-Commit Transaction in .NET Pin
Guffa18-Aug-06 1:29
Guffa18-Aug-06 1:29 
AnswerRe: Begin-Commit Transaction in .NET Pin
Guffa18-Aug-06 1:26
Guffa18-Aug-06 1:26 
GeneralRe: Begin-Commit Transaction in .NET Pin
Coding C#18-Aug-06 1:30
Coding C#18-Aug-06 1:30 
AnswerRe: Begin-Commit Transaction in .NET Pin
Dustin Metzgar18-Aug-06 3:27
Dustin Metzgar18-Aug-06 3:27 
The link and code provided in earlier responses do work well, but they are old ways of performing transactions. .Net 2.0 has a thing called TransactionScope in the System.Transactions namespace.
using (TransactionScope scope = new TransactionScope()) 
{
    using (SqlConnection connection = new SqlConnection(connectString))
    {
        connection.Open();

        SqlCommand command = connection.CreateCommand();
        try
        {
            command.CommandText =
              "INSERT INTO Production.ScrapReason(Name) VALUES('Wrong size')";
            command.ExecuteNonQuery();
            command.CommandText =
              "INSERT INTO Production.ScrapReason(Name) VALUES('Wrong color')";
            command.ExecuteNonQuery();
            scope.Complete();
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex.Message);
            Console.WriteLine("Neither record was written to database.");
        }
    }
}

TransactionScope has the ability to nest transactions and will also automatically upgrade a transaction into a distributed transaction if you start talking to two or more different databases. And when .Net 3 and WCF come along, WCF services will also be able to participate in the transaction.




Logifusion[^]
If not entertaining, write your Congressman.
GeneralRe: Begin-Commit Transaction in .NET Pin
Coding C#18-Aug-06 5:13
Coding C#18-Aug-06 5:13 
Questionget the name of a parameter as a string Pin
C-Scharbe18-Aug-06 1:06
C-Scharbe18-Aug-06 1:06 
AnswerRe: get the name of a parameter as a string Pin
Christian Graus18-Aug-06 1:17
protectorChristian Graus18-Aug-06 1:17 
AnswerRe: get the name of a parameter as a string Pin
Coding C#18-Aug-06 1:20
Coding C#18-Aug-06 1:20 
GeneralRe: get the name of a type-member as a string Pin
C-Scharbe18-Aug-06 4:07
C-Scharbe18-Aug-06 4:07 
AnswerRe: get the name of a parameter as a string Pin
beatles169220-Aug-06 20:34
beatles169220-Aug-06 20:34 
QuestionHow to delete NODE in BINARY SEARCH TREE,.... Pin
hkim_zoro18-Aug-06 0:48
hkim_zoro18-Aug-06 0:48 
AnswerRe: How to delete NODE in BINARY SEARCH TREE,.... Pin
Divyang Mithaiwala18-Aug-06 0:56
Divyang Mithaiwala18-Aug-06 0:56 
GeneralRe: How to delete NODE in BINARY SEARCH TREE,.... Pin
hkim_zoro19-Aug-06 23:42
hkim_zoro19-Aug-06 23:42 
AnswerRe: How to delete NODE in BINARY SEARCH TREE,.... Pin
Ennis Ray Lynch, Jr.18-Aug-06 4:28
Ennis Ray Lynch, Jr.18-Aug-06 4:28 
AnswerRe: How to delete NODE in BINARY SEARCH TREE,.... Pin
hkim_zoro19-Aug-06 23:48
hkim_zoro19-Aug-06 23:48 
GeneralRe: How to delete NODE in BINARY SEARCH TREE,.... Pin
Ennis Ray Lynch, Jr.20-Aug-06 6:05
Ennis Ray Lynch, Jr.20-Aug-06 6:05 
GeneralRe: How to delete NODE in BINARY SEARCH TREE,.... Pin
hkim_zoro24-Aug-06 1:30
hkim_zoro24-Aug-06 1:30 
QuestionError : Class Not Registered Pin
venkatttttttttttt18-Aug-06 0:43
venkatttttttttttt18-Aug-06 0:43 
AnswerRe: Error : Class Not Registered Pin
Christian Graus18-Aug-06 1:26
protectorChristian Graus18-Aug-06 1:26 
Questionhow to join two datatables in dataset? (no SQL)[modified] Pin
sheetal alaspure17-Aug-06 23:11
sheetal alaspure17-Aug-06 23:11 
AnswerRe: how to join two datatables in dataset? (no SQL)[modified] Pin
sheetal alaspure18-Aug-06 1:43
sheetal alaspure18-Aug-06 1:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.