示例#1
0
        void SaveConfig()
        {
            switch (DBType)
            {
            case DatabaseType.PivasDB:
                db.IniWriteValuePivas("Database", "Data Source", tbDataSource.Text);
                db.IniWriteValuePivas("Database", "Initial Catalog", tbDBName.Text);
                db.IniWriteValuePivas("Database", "User ID", db.Encrypt(tbUserID.Text));
                db.IniWriteValuePivas("Database", "Password", db.Encrypt(tbPassword.Text));
                break;

            case DatabaseType.HISDB:
                db.IniWriteValueHIS("Database", "Data Source", tbDataSource.Text);
                db.IniWriteValueHIS("Database", "Initial Catalog", tbDBName.Text);
                db.IniWriteValueHIS("Database", "User ID", db.Encrypt(tbUserID.Text));
                db.IniWriteValueHIS("Database", "Password", db.Encrypt(tbPassword.Text));
                break;

            default:
                break;
            }
        }
示例#2
0
 public bool Update(string syncode)
 {
     string[] DataSource = new string[5];
     DataSource[0] = Label_TypeText.Text;
     DataSource[1] = db.Encrypt(Txt_DataSource.Text.Replace("数据库地址", ""));
     if (!Equals(Label_TypeText.Text, "Oracle"))
     {
         DataSource[2] = db.Encrypt(Txt_InitialCatalog.Text.Replace("数据库名", ""));
     }
     DataSource[3] = db.Encrypt(Txt_UserID.Text.Replace("用户名", ""));
     DataSource[4] = db.Encrypt(Txt_Password.Text.Replace("密码", ""));
     //MessageBox.Show(update.Get_SynSet(SynCode, DataSource, textBox1.Text));
     if (db.SetPIVAsDB(update.Get_SynSet(SynCode, DataSource, textBox1.Text)) > 0)
     {
         return(true);
     }
     else
     {
         string ss = "添加或修改设置失败\r\nSQL为\r\n\r\n" + update.Get_SynSet(SynCode, DataSource, textBox1.Text);
         MessageBox.Show(ss, "失败");
         return(false);
     }
 }