using System; using System.Configuration; namespace GcoopServiceCs { public class DwTrans : Sybase.DataWindow.Transaction { private String connectionString; public String ConnectionString { get { return connectionString; } set { connectionString = value; } } public DwTrans(String connectionString) : base(new System.ComponentModel.Container()) { try { //state = new WebState(); this.connectionString = connectionString; } catch { } if ((GetElement("Data Source")) != null) { /* // Profile iscoicooptrn_new@127.0.0.1/icoop SQLCA.DBMS = "O10 Oracle10g (10.1.0)" SQLCA.LogPass = <****************> SQLCA.ServerName = "127.0.0.1/icoop" SQLCA.LogId = "iscoicooptrn_new" SQLCA.AutoCommit = False SQLCA.DBParm = "PBCatalogOwner='iscoicooptrn_new',TableCriteria=',iscoicooptrn_new'" */ try { //state = new WebState(); this.connectionString = connectionString; this.Dbms = Sybase.DataWindow.DbmsType.Oracle10g; this.Password = GetElement("Password"); this.ServerName = GetElement("Data Source"); this.UserId = GetElement("User ID"); this.AutoCommit = false; this.DbParameter = "PBCatalogOwner='" + this.UserId + "',TableCriteria='," + this.UserId + "',Pooling=False"; } catch { } } else { /* // Profile iscoicooptrn MYSQL PB connection String SQLCA.DBMS = "ADO.Net" SQLCA.LogPass = <****> SQLCA.LogId = "root" SQLCA.AutoCommit = False SQLCA.DBParm = "Namespace='MySql.Data.MySqlClient',DataSource='127.0.0.1',Database='iscoicooptrn',PBCatalogOwner='iscoicooptrn'" */ try { //state = new WebState(); this.connectionString = connectionString; //this.Dbms = "ADO.NET"; this.Password = GetElement("Pwd"); this.ServerName = GetElement("Server"); this.UserId = GetElement("Uid"); this.AutoCommit = false; this.DbParameter = "Namespace='MySql.Data.MySqlClient',DataSource='" + this.UserId + "',Database='" + GetElement("Database") + "',PBCatalogOwner='" + GetElement("Database") + "'"; } catch { } /* // Profile iscoicooptrn_odbc SQLCA.DBMS = "ODBC" SQLCA.AutoCommit = False SQLCA.DBParm = "ConnectString='DSN=iscoicooptrn;UID=root;PWD=<******>'" */ try { //state = new WebState(); this.connectionString = connectionString; this.Dbms = Sybase.DataWindow.DbmsType.Odbc; this.Password = GetElement("Pwd"); //this.ServerName = GetElement("Server"); this.UserId = GetElement("Uid"); this.AutoCommit = false; this.DbParameter = "ConnectString='DSN=" + GetElement("Database") + ";UID=" + GetElement("Uid") + ";PWD=" + GetElement("Pwd") + "'"; } catch { } } } /* Sybase.DataWindow.AdoTransaction sqlcaMysql; MySqlConnection oMySqlConn = new MySqlConnection(); public Sybase.DataWindow.AdoTransaction connMysql() { try { oMySqlConn.ConnectionString = "User ID=" + GetElement("Uid") + ";" + "Password=" + GetElement("Pwd") + ";" + "Host=" + GetElement("Server") + ";" + "Port=" + GetElement("Port") + ";" + "Database=" + GetElement("Database") + ";"; oMySqlConn.Open(); sqlcaMysql = new Sybase.DataWindow.AdoTransaction(oMySqlConn); sqlcaMysql.BindConnection(); } catch { } return sqlcaMysql; } public void disMysql() { try { oMySqlConn.Close(); } catch { } } */ private String GetElement(String elementName) { String result = null; try { String[] conArray = connectionString.Split(';'); for (int i = 0; i < conArray.Length; i++) { if (conArray[i].IndexOf(elementName) == 0) { String[] ar2 = conArray[i].Split('='); result = ar2[1].Trim(); break; } } } catch { result = null; } return result; } } }