예제 #1
0
        private bool TestConn()
        {
            DbConnect = new DBConnectModel
            {
                ServerName = txtServerName.Text,
                DBName     = txtDBName.Text,
                Account    = txtAccount.Text,
                Password   = txtPassword.Text
            };

            using (var conn = new SqlConnection(DbConnect.ConnectionString))
            {
                try
                {
                    conn.Open();
                    _testSuccess = true;
                }
                catch
                {
                    _testSuccess = false;
                }
            }

            return(_testSuccess);
        }
예제 #2
0
 public SetConnect(DBConnectModel dbConnectModel)
 {
     InitializeComponent();
     if (dbConnectModel == null)
     {
         return;
     }
     DbConnect          = dbConnectModel;
     txtServerName.Text = DbConnect.ServerName;
     txtDBName.Text     = DbConnect.DBName;
     txtAccount.Text    = DbConnect.Account;
     txtPassword.Text   = DbConnect.Password;
 }
예제 #3
0
        private void btnSetDestConn_Click(object sender, EventArgs e)
        {
            var setConnect = new SetConnect(_destDbConnectModel)
            {
                StartPosition = FormStartPosition.WindowsDefaultLocation
            };
            var dialogResult = setConnect.ShowDialog();

            if (dialogResult == DialogResult.OK)
            {
                _destDbConnectModel = setConnect.DbConnect;
                lblDestConnStr.Text = setConnect.DbConnect.ConnectionString;
            }
        }
예제 #4
0
 private void btnCancel_Click(object sender, EventArgs e)
 {
     DialogResult = DialogResult.Cancel;
     DbConnect    = null;
 }