BeginTransaction

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
bclayshannon
Posts: 29
Joined: Wed 14 Mar 2012 18:37
Location: Monterey, California

BeginTransaction

Post by bclayshannon » Tue 20 Mar 2012 00:19

This page:

http://www.devart.com/dotconnect/oracle ... tions.html

shows this code:

Code: Select all

ot = oc.BeginTransaction(System.Data.IsolationLevel.ReadCommitted);
..but my code:

Code: Select all

OracleTransaction ot;
                ot = oc.BeginTransaction(System.Data.IsolationLevel.ReadCommitted);
                // Assign transaction object for a pending local transaction 
                oc.Transaction = ot;
...gives this err msg.

'Devart.Data.Oracle.OracleCommand' does not contain a definition for 'BeginTransaction' and no extension method 'BeginTransaction' accepting a first argument of type 'Devart.Data.Oracle.OracleCommand' could be found (are you missing a using directive or an assembly reference?)

Why?

bclayshannon
Posts: 29
Joined: Wed 14 Mar 2012 18:37
Location: Monterey, California

Help file unavailable

Post by bclayshannon » Tue 20 Mar 2012 15:48

In connection with my Transaction dilemma, I downloaded the .chm file from the bottom of this page:

http://www.devart.com/dotconnect/oracle/features.html

...but it contains only a structure, no content (or the content is unavailable, at any rate).

Can anybody point me to a dotConnect Transaction tutorial or some such?

bclayshannon
Posts: 29
Joined: Wed 14 Mar 2012 18:37
Location: Monterey, California

Eureka!

Post by bclayshannon » Tue 20 Mar 2012 15:59

Oh, I see - I was trying to call .BeginTransaction() on an OracleCommand component when I should have been calling it on OracleConnection. Here's my updated and working code:

Code: Select all

        private void UpdateRecord(string ATicketID, string ATicketSource, string AAboutLLSID, string ACategoryID, string AContactID)
        {
            oracleConnection1.Open();
            OracleCommand ocmd = new OracleCommand();
            OracleTransaction ot;
            // Start a local transaction 
            ot = oracleConnection1.BeginTransaction(System.Data.IsolationLevel.ReadCommitted);
            // Assign transaction object for a pending local transaction 
            ocmd.Transaction = ot;
            ocmd.Connection = oracleConnection1;
            try
            {
                ocmd.CommandText = @"UPDATE LLS.INTERPRETERTICKETS 
                                     SET TICKETSOURCE = :p_TICKETSOURCE, 
                                     ABOUTLLSID = :p_ABOUTLLSID, 
                                     CATEGORYID = :p_CATEGORYID, 
                                     CONTACTEMAIL = :p_CONTACTEMAIL 
                                     WHERE TICKETID = :p_TICKETID";
                ocmd.Parameters.Add("p_TICKETSOURCE", ATicketSource);
                ocmd.Parameters.Add("p_ABOUTLLSID", Convert.ToInt32(AAboutLLSID));
                ocmd.Parameters.Add("p_CATEGORYID", Convert.ToInt32(ACategoryID));
                ocmd.Parameters.Add("p_CONTACTEMAIL", AContactID);
                ocmd.Parameters.Add("p_TICKETID", ATicketID);
                ocmd.ExecuteNonQuery();
                ot.Commit();
                Popul8TheGrid();
            }
            catch (Exception e)
            {
                ot.Rollback();
                throw;
            }
            finally
            {
                oracleConnection1.Close();
            }
        }

Pinturiccio
Devart Team
Posts: 2192
Joined: Wed 02 Nov 2011 09:44

Post by Pinturiccio » Wed 21 Mar 2012 11:34

bclayshannon wrote:Oh, I see - I was trying to call .BeginTransaction() on an OracleCommand component when I should have been calling it on OracleConnection.
Yes, you are right. BeginTransaction() is a method of OracleConnection.
bclayshannon wrote:In connection with my Transaction dilemma, I downloaded the .chm file
...but it contains only a structure, no content (or the content is unavailable, at any rate).
Looks like your system blocks downloaded chm files because of security reasons. You may unblock the downloaded
chm file in the following way:

Right-click the file and select Properties from the shortcut menu, then click the Unblock button in the Properties dialog box.

You may read more about this issue here: http://blog.crowe.co.nz/archive/2007/04/13/719.aspx

bclayshannon
Posts: 29
Joined: Wed 14 Mar 2012 18:37
Location: Monterey, California

Dan Blocker

Post by bclayshannon » Wed 21 Mar 2012 15:33

The "Unblock" worked - thanks!

Post Reply