private bool LinkContentTest() { string dbUser = this.skinTextBox_contentAccount.SkinTxt.Text.Trim(); string dbAddress = this.skinTextBox_contentAddress.SkinTxt.Text.Trim(); string dbName = this.skinTextBox_contentDbName.SkinTxt.Text.Trim(); string dbPassword = this.skinTextBox_contentPwd.SkinTxt.Text.Trim(); string strSql = "Server=" + dbAddress + ";User Id=" + dbUser + ";Password="******";Database=master;";//连接数据库字符串 int retNum = new InstallDB().CheckDataBase(strSql, dbName, System.Environment.CurrentDirectory); if (retNum <= 0) { MessageBox.Show("文件内容服务器配置信息的连接地址或者账号密码错误,请重新设置!"); return(false); } else if (retNum == 1) { MessageBox.Show(string.Format("文件内容服务器配置信息数据库名称:{0} 已经存在,请重新设置名称!", dbName)); return(false); } else if (retNum == 2) { return(true); } return(false); }
private void FrmWait_Shown(object sender, EventArgs e) { try { bool ret = false; if (type == 1) { //CheckFolderDownloadFromDb(this.forderPath, this.user); // 开始安装 FileManager.ServerSetup.InstallDB install = new ServerSetup.InstallDB(); ret = install.InstallBySql(dbname, type, server, uid, pwd); } else { //CheckFolderUploadToDb(this.forderPath, this.user); // 开始安装 FileManager.ServerSetup.InstallDB install = new ServerSetup.InstallDB(); ret = install.InstallBySql(dbname, type, server, uid, pwd); } this.DialogResult = ret ? System.Windows.Forms.DialogResult.OK : System.Windows.Forms.DialogResult.No; } catch (Exception ex) { MessageBox.Show(ex.Message); return; } }
private bool LinkManagerTest() { string dbUser = this.skinTextBox_managerAccount.SkinTxt.Text.Trim(); string dbAddress = this.skinTextBox_managerAddress.SkinTxt.Text.Trim(); string dbName = this.skinTextBox_managerDbName.SkinTxt.Text.Trim(); string dbPassword = this.skinTextBox_managerPwd.SkinTxt.Text.Trim(); //string conn = string.Format("server={0};uid={1};pwd={2};database={3};Connect Timeout=3", dbAddress, dbUser, dbPassword, dbName); string strSql = "Server=" + dbAddress + ";User Id=" + dbUser + ";Password="******";Database=master;";//连接数据库字符串 int retNum = new InstallDB().CheckDataBase(strSql, dbName, System.Environment.CurrentDirectory); if (retNum <= 0) { MessageBox.Show("文件管理服务器配置信息的连接地址或者账号密码错误,请重新设置!"); return(false); } else if (retNum == 1) { MessageBox.Show(string.Format("文件管理服务器配置信息数据库名称:{0} 已经存在,请重新设置名称!", dbName)); return(false); } else if (retNum == 2) { return(true); } return(false); }