Topobase

Reply
Contributor
Posts: 14
Registered: ‎02-19-2009
Message 1 of 2 (118 Views)

How to use transaction?

118 Views, 1 Replies
05-22-2009 03:08 AM
How can I use Topobase.Data.Provider.Transaction?

In the Oracle the solution is the follow:
Oracle.DataAccess.Client.OracleTransaction myOracleTransaction = myOraConn.BeginTransaction();
Oracle.DataAccess.Client.OracleCommand _cmd = myOraConn.CreateCommand();
...
myOracleTransaction.Commit();

How can I do it with Topobase data provider? Please send me a short example.
Contributor
Posts: 14
Registered: ‎02-19-2009
Message 2 of 2 (118 Views)

Re: How to use transaction?

09-08-2009 02:45 AM in reply to: satu777
Solution from myself... maybe if somebody needs this...

String sqlScript = "Select * from Dump";
mySqlConn = new gl2ora.SqlCon(OracleSID, OracleUsername, OraclePassword);
myOraConn = mySqlConn.Make();
Oracle.DataAccess.Client.OracleTransaction myOracleTransaction = myOraConn.BeginTransaction();
Oracle.DataAccess.Client.OracleCommand _cmd = myOraConn.CreateCommand();
_cmd.CommandText = sqlScript;
try
{
_cmd.ExecuteNonQuery();
}
catch (System.Exception _ex)
{
//Error
myOracleTransaction.Rollback();
return false;
}
}
//All done
myOracleTransaction.Commit();

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Welcome to the new Autodesk Community!
If this is your first visit, click here to get started and make the most of the Community. Let us know what you think of the new experience in the Community Feedback Forum.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community