コード例 #1
0
        /// <summary>
        /// Letting choose to either Sql ortextfile as the database
        /// </summary>
        /// <param name="db">DatabaseConnectionType Enum</param>
        public static void InitializeConnection(DatabaseConnectionTypes db)
        {
            if (db == DatabaseConnectionTypes.MySql)
            {
                Connection = new SqlConnector(SqlConnectionSingleton.getMySqlConnection());
            }

            else if (db == DatabaseConnectionTypes.TextFile)
            {
                //Connection=new TextConnector();
            }
        }
コード例 #2
0
 private DbServerModel GetServerModel()
 {
     try
     {
         Form.Cursor = Cursors.WaitCursor;
         var builder = new ConnectionStringBuilder(Form.ServerName, "master", Form.UserName, Form.Password, Form.AuthType == AuthType.Windows);
         SqlConnectionSingleton.SetConnectionString(builder.MasterConnectionString);
         Form.Cursor = Cursors.Default;
         return(DbServerManagerSingleton.GetInstance().Connect());
     }
     catch (System.Exception ex)
     {
         Form.Cursor = Cursors.Default;
         MsgBox.ShowError(ex.Message);
         return(null);
     }
 }