public static bool Manage_DBConnection(Form ParentForm,string recent_items_folder, bool bChangeConnection) { if ((Settings.Log2DB_flags & const_Log2DB_flag_Write2DB_on_exit) > 0) { // Check LogDataBaseConnection if (m_LogDB_con == null) { m_LogDB_con = new Log_DBConnection(recent_items_folder); } Log_RemoteDB_data_ProgramSettings = new Log_RemoteDB_data(const_inifile_prefix, 1, Log_DBConnection.eDBType.MSSQL, LanguageControl.lngRPM.s_Connection_To_LogTables_defualt_ProgramSettings.s); return GetConnection(ParentForm, Log_RemoteDB_data_ProgramSettings, bChangeConnection); } else { return true; } }
public static bool GetConnection(Form ParentForm,Log_RemoteDB_data Log_RemoteDB_data_ProgramSettings, bool bChangeConnection) { string Err = null; if (bChangeConnection) { if (!m_LogDB_con.CreateNewDataBaseConnection(ParentForm, Log_RemoteDB_data_ProgramSettings)) { return false; } } if (m_LogDB_con.MakeDataBaseConnection(ParentForm, Log_RemoteDB_data_ProgramSettings)) { if (Log_RemoteDB_data_ProgramSettings.Save(const_inifile_prefix, ref Err)) { if (CheckTables(m_LogDB_con)) { return true; } else { if (MessageBox.Show("LogFile Tables not exists! Create LogFile Tables ?", "?", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes) { SQL_LogTables sql_log_tables = new SQL_LogTables(m_LogDB_con); if (sql_log_tables.Create_SQL_LogTables()) { if (CheckTables(m_LogDB_con)) { return true; } else { return false; } } else { return true; } } else { return false; } } } else { Error.Show(Err); } } return false; }