Пример #1
0
        private void initialForm()
        {
            appConfig appconfig = appConfig.getDefaultConfig();

            if (appconfig != null)
            {
                this.type = appconfig.dbType;
            }
            //DBType type = ConfigManager.GetCurrentDBType();
            SQLConnConfig config = SQLConnConfig.getDefaultDBConfig(type);

            //type = config.dbType;
            if (type == DBType.sqlserver)
            {
                this.comboBox1.SelectedIndex = 0;
            }
            else if (type == DBType.sqlite)
            {
                this.comboBox1.SelectedIndex = 1;
            }

            //string connStr = ConfigManager.GetDBConnectString(type);
            if (config != null)
            {
                this.connectString = config.connectString;
            }
            this.txtConnString.Text = connectString;
        }
Пример #2
0
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            SQLConnConfig config = null;

            switch (this.comboBox1.SelectedIndex)
            {
            case 0:
                //ConfigManager.SaveCurrentDBType(DBType.sqlserver);
                config = SQLConnConfig.getDefaultDBConfig(DBType.sqlserver);
                if (config != null)
                {
                    this.txtConnString.Text = config.connectString;
                }
                else
                {
                    this.txtConnString.Text = string.Empty;
                }
                //this.txtConnString.Text = ConfigManager.GetDBConnectString(DBType.sqlserver);
                break;

            case 1:
                config = SQLConnConfig.getDefaultDBConfig(DBType.sqlite);
                if (config != null)
                {
                    this.txtConnString.Text = config.connectString;
                }
                else
                {
                    this.txtConnString.Text = string.Empty;
                }
                //ConfigManager.SaveCurrentDBType(DBType.sqlite);
                //this.txtConnString.Text = ConfigManager.GetDBConnectString(DBType.sqlite);
                break;
            }
        }
Пример #3
0
 public static bool checkDBSetting()
 {
     if (staticClass.currentDbType == DBType.None)
     {
         appConfig appconfig = appConfig.getDefaultConfig();
         if (appconfig != null)
         {
             staticClass.currentDbType = appconfig.dbType;
             SQLConnConfig config = SQLConnConfig.getDefaultDBConfig(staticClass.currentDbType);
             if (config != null)
             {
                 staticClass.currentDBConnectString = config.connectString;
             }
             else
             {
                 return(false);
             }
         }
         else
         {
             return(false);
         }
     }
     return(true);
 }
Пример #4
0
 public static string rtConnection()
 {
     if (connectString == string.Empty)
     {
         appConfig appconfig = appConfig.getDefaultConfig();
         if (appconfig != null)
         {
             SQLConnConfig config = null;
             config = SQLConnConfig.getDefaultDBConfig(appconfig.dbType);
             if (config != null)
             {
                 connectString = config.connectString;
             }
         }
     }
     return(connectString);
 }