'Oracle.DataAccess.Client.OracleCommand.Transaction' cannot be assigned to -- it is read only

Hi,

 We are converting our existing data access code for Oracle Database. And For methods which are envolved with Transaction I am getting following error.

 command.Transaction = this._sqlTransaction;

 Error:  Property or indexer 'Oracle.DataAccess.Client.OracleCommand.Transaction' cannot be assigned to -- it is read only

Urgently Help Required.

Thanks.

 Vishal

0
vishal2006
5/9/2007 12:05:17 PM
asp.net.oracle 2269 articles. 0 followers. Follow

4 Replies
1850 Views

Similar Articles

[PageSpeed] 37

Could you please post more code showing details of   this._sqlTransaction  ?

 What is it and how is it created?


Regards,
Prashant


Dont forget to click "Mark as Answer" on the post that helped you.
0
Prashant
5/10/2007 5:43:05 AM

Here I am using a base class for connection. Base class contains the OracleConnection Object. And in the derived class Transactions, I have a _sqlTransaction member.
Following is the code.

public

class Transactions : BaseClass

{

// Fields

private OracleTransaction _sqlTransaction;

public void AMethod()
{
   try
  {
     OracleCommand command = new OracleCommand("SPNameHere");
     if (this._sqlTransaction == null)
     {
         command.Connection =
base._sqlCon;
     }
     else
     {
         command.Connection = this._sqlTransaction.Connection;
     }
     command.CommandType = CommandType.StoredProcedure;

      if (this._sqlTransaction == null)
      {
            base._sqlCon.Open();
      }
     else
      {

                        //  Following line generates error : OracleCommand.Transaction cannot be assigned to -- it is read only
                        command.Transaction = this._sqlTransaction;
       }

       command.ExecuteNonQuery();

  }

  finally
   {
        if (this._sqlTransaction == null)
         {
            base._sqlCon.Close();

         }
    }

}

Is this help understand my problem.

 

Thanks & Regards,

Vishal

0
vishal2006
5/11/2007 7:34:05 AM

I can't see where you are creating/beginning your transaction.

You have to do something like the following:

_sqlTransaction = _sqlCon.BeginTransaction()

 

For more details refer to the following links

http://www.akadia.com/services/dotnet_dbtrans.html 

http://www.oracle.com/technology/pub/articles/price_dbtrans_dotnet.html 


Regards,
Prashant


Dont forget to click "Mark as Answer" on the post that helped you.
0
Prashant
5/13/2007 1:08:00 PM

Hi Prashant !

 Thanks for the link.

The Problem was with the Orace Driver. Oracle Database driver 10.1.0.2.0  for Oracle 10g.

It does not support following syntax.

OracleConnection con = new OracleConnection(.........);

OracleTransaction trans = con.BeginTransaction();

OracleCommand command = new OracleCommand(sqlquery);

command.Transaction = trans;                          // This line gives compilation error.

...

....

....

Following code runs fine.

OracleConnection con = new OracleConnection(.........);

OracleTransaction trans = con.BeginTransaction();

OracleCommand command = con.CreateCommand();

command.CommandText = sqlquery;

Thanks,

Vishal

0
vishal2006
5/19/2007 7:10:02 AM
Reply:

Similar Artilces:

Error: Can't load '/cygdrive/c/Oracle/Ora81/bin/Oracle' for module DBD::Oracle...
------_=_NextPart_001_01C4BD25.2E53B509 Content-Type: multipart/alternative; boundary="----_=_NextPart_002_01C4BD25.2E53B509" ------_=_NextPart_002_01C4BD25.2E53B509 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi guys, =20 Here is what's going on:=20 =20 1. I am running the latest release of CygWin on a Windows XP machine. I am not running ActiveState Perl. 2. I installed DBI and tested it. Looks like it's working fine. I typed: =20 perl -MDBI -e 0 =20 at the ...

BC30002: Type 'Oracle.DataAccess.Client.OracleConnection' is not defined
Could someone please help me in tracing the error, "BC30002: Type 'Oracle.DataAccess.Client.OracleConnection' is not defined". I added the reference too,but still getting the same error Am using windows 2003, IIS 6.0 My Code: <%@ Page Language="VB" %> <%@ Import Namespace="System.Data"%> <%@ import Namespace="Oracle.DataAccess.Client" %> <%@ import Namespace="Oracle.DataAccess.types" %> <script runat="server"> Private Sub Page_Load(sender As Object, e As EventArgs) ...

BC30002: Type 'Oracle.DataAccess.Client.OracleConnection' is not defined.
Could someone assist me in tracing the error : BC30002: Type 'Oracle.DataAccess.Client.OracleConnection' is not defined. I add the reference also but still getting the same error. Am using Windows 2003, IIS 6.0 My code is : <%@ Page Language="VB" %> <%@ Import Namespace="System.Data"%> <%@ import Namespace="Oracle.DataAccess.Client" %> <%@ import Namespace="Oracle.DataAccess.types" %> <script runat="server"> Private Sub Page_Load(sender As Object, e As EventArgs) ' Insert page ...

The type initializer for 'Oracle.DataAccess.Client.OracleConnection' threw an exception
I have a VB .Net 2.0 web application which accesses oracle 8i database, the database was upgraded to 9i later on. The application worked fine just before the upgrade was made, but after the upgrade the application gives the following error. The type initializer for 'Oracle.DataAccess.Client.OracleConnection' threw an exception. I did a few searches in the oracle forums and downloaded and installed the Oracle Data Provider for .NET  version 9.2.0.4 form orcale website but the application still throws out the above exception. following is the stack trace of the application...

''''''''''''''''''''
Name: haznen Email: haznenatyahoodotcom Product: Gran Paradiso Alpha 8 Summary: '''''''''''''''''''' Comments: '''''''''''''''''''''''''''''''''''' Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a1) Gecko/20061204 UGES/1.7.2.0 GranParadiso/3.0a1 From URL: http://www.mozilla.org/projects/granparadiso/ Note to readers: Hendrix gives...

'Oracle.DataAccess' could not be loaded.
Hi,I have loaded my web application on my web server. I am using Oracle Database and I have also installed ODP.Net on my server, but every time I try to connect to the database I get this error,  File or assembly name Oracle.DataAccess, or one of its dependencies, was not found. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.IO.FileNotFoundException: File or assembly name Oracle.DataAccess, or one of its depend...

'''''
Name: mario Email: ramar17atfastwebnetdotit Product: Gran Paradiso Alpha 2 Summary: ''''' Comments: K: Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a2) Gecko/20070206 GranParadiso/3.0a2 ...

help! why i can not use ' out parameter' in 'oracle procedure'
i compile and execute the procedure in sqlplus(oracle tools) but i can not use it in powerbuilder. foe example: the procedure is : CREATE or replace PROCEDURE spm1 (dept varchar2 ,mgr_name out varchar2) IS lutype varchar2(10); BEGIN mgr_name:=dept||'out end'; END; the powerbuilder scipt is : DECLARE gg PROCEDURE FOR SPM1 (:dept1); execute gg; messagebox("",string(sqlca.sqlcode)+sqlca.sqlerrtext) i get error,and the error is : pls:00306. and oracle document explain the error is : PLS-00306: wrong number or t...

Getting Error Message "Can't load 'C:/Perl64/lib/auto/DBD/Oracle/Oracle.dll" While Connecting to Oracle
--755704646-1080936359-1390695547=:84331 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable I am trying to configure an Oracle connection from Perl running on a Window= s 7 desktop to an Oracle 11g database running on Linux; however the databas= e connection step is failing.=0A=0AThe following line of perl code fails:= =0A=0A=A0 =A0use DBD::Oracle;=0A=0ABelow is the full error message:=0A=0ACa= n't load 'C:/Perl64/lib/auto/DBD/Oracle/Oracle.dll' for module DBD::Oracle:= load_file:%1 is not a valid Win32 application at C:/Perl64/lib/D...

'do' won't 'do' if '/'
Greetings to All from Au, Have a NetWare Perl 5.8.4 and wanted to tweak File\Spec\NW.pm to try and standardise on '/' separators. If I run a test script (t/uni/lower.t) with an unmodified NW.pm, it calls t/uni/case.pl, that, in case.pl, (when the path separators are '\'), the $file is '..\lib\unicore\To\Lower.pl' and the following code portion works, with $simple getting a returned table: sub casetest { my ($base, $spec, $func) = @_; my $file = File::Spec->catfile(File::Spec->catdir(File::Spec->updir, "lib", &qu...

'''
Name: L Lachowsky Email: e2brutus_10atyahoodotcom Product: Firefox Summary: ''' Comments: why duddn this surprise me... I change default server from IE to Mozilla, and then i get error messages. well, shud I decide to not get on my computer with Mozilla..or shud I risk security breeches with IE....hmmm at least i can get on the internet with IE Browser Details: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.5) Gecko/2008120122 Firefox/3.0.5 From URL: http://hendrix.mozilla.org/ Note to readers: Hendrix gives no expectation of a response to this fee...

Cast from type ''''DBNull'''' to type ''''String'''' is not valid.
How do I avoid getting this error: Cast from type ''''DBNull'''' to type ''''String'''' is not valid. I am trying to get values from the database into a form for updating using a Datareader, SQL is set to allow nulls for certain fields as they are not required but the only way I can get the form to display is by adding a space in SQL. Is there another way around this? Check if it is equal to DBNull.Value first and if it is, don't do the cast.Stanley Tan theSpoke Blog Where in the code does it need to go? I am using the following and it's the profile that isn't always requi...

'active transaction log' versus 'local transaction log'
Both Cons. Db and remote Db are running on (separate) servers. I start dbremote on both sites from an client-pc. on the Cons.db, the dbremote-window says it uses the 'active transaction log', which is good. but on the remote.db, dbremote uses the 'local transaction log D:\map\dbname.log' in which D: is the Hdisk of the SERVER. result is a non-working dbremote on the client-pc's of the remote site. What must I do to let dbremote use the 'active transaction log' too on my remote site ?? Please show us the dbremote commands you're executin...

test DBD::Oracle DBI connect('','user/password@database',...) failed: ORA-12154
--0-621501335-1235620987=:55352 Content-Type: text/plain; charset=us-ascii I can connect to the database using sqlplus as user oracle, but not as root. I can compile DBD::Oracle but not complete the test. I tried to set variables properly: ORACLE_HOME=/u/oracle/10.2.0 ORACLE_HOST=hostname ORACLE_PORT=1522 ORACLE_SID=databasename ORACLE_USERID=user/password@databasename PATH=/u/oracle/10.2.0/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/root/bin PWD=/usr/src/pub/dbd-oracle/DBD-Oracle-1.22 TNS_ADMIN=/u/or...

Web resources about - 'Oracle.DataAccess.Client.OracleCommand.Transaction' cannot be assigned to -- it is read only - asp.net.oracle

Resources last updated: 1/12/2016 4:47:50 PM