You can export an ADO.NET connection from a PowerBuilder WPF application, enabling the same database connection to be shared by an external .NET assembly.
Follow these guidelines to export a shared connection:
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;
// 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; ... } ... }