Ejemplo n.º 1
0
 private void kryBtnSel_Click(object sender, EventArgs e)
 {
     int selIndex = this.kryCbxSel.SelectedIndex;
     switch (selIndex)
     {
         case 0:
             {
                 UserBL bl = new UserBL();
                 List<User> users = bl.GetUsers();
                 this.bindSrcUsers.DataSource = users;
                 kryDgvMng.DataSource = this.bindSrcUsers;
                 break;
             }
         case 1:
             {
                 DbConnBL bl = new DbConnBL();
                 List<DbConn> conns = bl.GetDbConns();
                 this.bindSrcDbConns.DataSource = conns;
                 kryDgvMng.DataSource = this.bindSrcDbConns;
                 break;
             }
         case 2:
             {
                 SqlSentenceBL bl = new SqlSentenceBL();
                 List<SqlSentence> sqls = bl.GetSqls();
                 this.bindSrcSqls.DataSource = sqls;
                 kryDgvMng.DataSource = this.bindSrcSqls;
                 break;
             }
         default:
             KryptonMessageBox.Show("请选择配置表!");
             break;
     }
 }
Ejemplo n.º 2
0
        void GetMsSqlDBCS()
        {
            dbcs =  ConfigurationManager.ConnectionStrings["DBCS"] != null
                ? ConfigurationManager.ConnectionStrings["DBCS"].ConnectionString
                : "";
            if (string.IsNullOrWhiteSpace(dbcs))
            {
                //从SQLite读取
                DbConnBL bl = new DbConnBL();
                string connString = "data source={0};initial catalog={1};user id={2};Password={3}";
                DbConn conn = bl.GetDbConn("DEFAULT");
                if (conn != null)
                    dbcs = string.Format(connString, conn.DataSource, conn.Catalog, conn.UserId, conn.Password);

                if (string.IsNullOrWhiteSpace(dbcs))
                    KryptonMessageBox.Show("没有配置master数据库连接字符串!\r\n请配置后重启应用程序!"
                    , "警告", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }