How do i set Savepoints for Linq to SQL and use "NO" ExecuteCommand ?

Posted by nik on Stack Overflow See other posts from Stack Overflow or by nik
Published on 2010-06-16T12:00:08Z Indexed on 2010/06/16 12:02 UTC
Read the original article Hit count: 200

    TransactionScope TransactionABC = new TransactionScope();
    try
    {
        context.Connection.Open();
        {
            context.ExecuteCommand("insert into test (test) values (1)")
            context.SubmitChanges();
                    context.ExecuteCommand("savepoint test");

            context.ExecuteCommand("insert into test (test) values (2)")
            context.SubmitChanges();

                    context.ExecuteCommand("rollback to test");
            }
    TransactionABC.Complete();
    TransactionABC.Dispose();

            }
   catch (Exception ec)
    {
    MessageBox.Show(" ", ec.Message);
    }
   finally
    {
        context.Connection.Close();
    }

It works, but only with ExecuteCommand. I want to use a function, because i can't see what happens in the savepoint !

© Stack Overflow or respective owner

Related posts about c#

Related posts about linq-to-sql