Connection Information

To perform the requested action, WordPress needs to access your web server. Please enter your FTP credentials to proceed. If you do not remember your credentials, you should contact your web host.

Connection Type

Exporting an ADO.NET Connection to a Third-Party .NET Assembly – PB Docs 126 – PowerBuilder Library

Exporting an ADO.NET Connection to a Third-Party .NET Assembly – PB Docs 126

Exporting an ADO.NET Connection to a Third-Party .NET Assembly

To export an ADO.NET connection from a PowerBuilder Classic
application, use the GetAdoConnection method:

The method returns an instance of IAdoConnectionProxy.
The proxy’s ADO connection object is assigned to property IAdoConnectionProxy.Connection.

When a transaction starts, the proxy’s active Transaction
object is assigned to property IAdoConnectionProxy.Transaction,
and AutoCommit is false. When AutoCommit is
true, the exported IAdoConnectionProxy.Transaction is
null..

The method returns null if the connection fails, and false
if the operation fails.

To use the shared connection, your third-party assembly must
reference the exported connection proxy and manage the transaction.
To be notified when the active transaction is changed, you can subscribe
the IAdoConnection.TransactionChanged event .
Remember to close the connection.

Sample PowerScript Code

//Sample PowerScript code
SQLCA.DBMS = "ADO.NET"
SQLCA.AutoCommit = false
SQLCA.DBParm = "Namespace='System.Data.Odbc',
DataSource='SQL
Anywhere
11 Demo'"
Connect Using SQLCA;
emp.ConnectionProxy = SQLCA.GetAdoConnection()
// db
operations
disconnect using SQLCA;

Sample C# Code

Here is an example of C# code in the third-party
assembly:

// Manage the transaction
public
class Emp {
...
IAdoConnectionProxy
proxy;
IDbTransaction trans;
...
public
object ConnectionProxy {
get { return
proxy; }
set {
proxy = value
as IAdoConnectionProxy;
...
proxy.TransactionChanged += new
EventHandler(proxy_TransactionChanged);
}
}
void
proxy_TransactionChanged(object sender, EventArgs e) {
...
trans = sender
as IDbTransaction;
...
}
...
}


Document get from Powerbuilder help
Thank you for watching.
Was this article helpful?
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x