[Mono-list] Exception only with mono

misterJane the_purple_turtle at hotmail.com
Tue Sep 16 04:58:01 EDT 2008


Hi,

I have a piece of code that executes a stored procedure.
When I run it with .net it executes fine.
When I run it with mono (1.9.1) i get the following exception :

The Connection object does not have the same transaction as the command
object.

Does anyone know what this exception means, and why it works fine directly
on .net, but on mono it throws this exception ?

Thanks !

The code looks something like  :

                SqlTransaction tr = cn.BeginTransaction()
                SqlCommand cmd = PrepareSPCommand("someCommand", tr);
                cmd.Parameters.AddWithValue("@par1", 1234);
                cmd.Parameters.AddWithValue("@par2", _exampleString);

                byte[] fileContent = File.ReadAllBytes(_file);
                cmd.Parameters.AddWithValue("@FileContent", fileContent);

                try
                {
                    cmd.ExecuteNonQuery();
                }
                catch (SqlException e)
                {
                    // do some stuff....                   
                    tr.Rollback();
                    throw new Exception(e.Message, e);
                }

                tr.Commit();
    


-- 
View this message in context: http://www.nabble.com/Exception-only-with-mono-tp19507938p19507938.html
Sent from the Mono - General mailing list archive at Nabble.com.



More information about the Mono-list mailing list