//int MAX_RETRY_COUNT = 5; public Database() { connection = new Connection(); try { conectionSettings = connectionProvider.getConnectionParameters(); } catch (Exception) { frmDBAyarlar frm = new frmDBAyarlar(); frm.ShowDialog(); frm.Dispose(); conectionSettings = connectionProvider.getConnectionParameters(); } if (conectionSettings.dbType == "ORACLE") { connection.DatabaseType = Enums.DbTypes.ORACLE; } else { connection.DatabaseType = Enums.DbTypes.MSSQL; } }
public static OdbcConnection getODBCConnection() { OdbcConnection connec = null; try { ConnectionSettings settings = LoadDbConnectionSettings(); if (String.IsNullOrEmpty(settings.dsn)) { frmDBAyarlar frm = new frmDBAyarlar(); frm.ShowDialog(); frm.Dispose(); getODBCConnection(); } string constr = "DSN=" + settings.dsn + ";UID=" + settings.uid + ";PWD=" + settings.pwd + ";"; connec = new OdbcConnection(constr); connec.Open(); } catch (Exception ex) { Console.WriteLine("Connection Error: " + ex.Message); } return(connec); }