Topobase

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

How to use transaction?

122 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
satu777
Posts: 14
Registered: ‎02-19-2009
Message 2 of 2 (122 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();
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.