Exemplo n.º 1
0
        private void btnTestConnect_Click(object sender, EventArgs e)
        {
            string SQLServer = txtSQLServer.Text;

            if (!validateTestCon())
            {
                MessageBox.Show("Please fill SQL Server or username, password");
            }
            if (chbWindowAuth.Checked)
            {
                connector = new SQLConnector(SQLServer);
            }
            else
            {
                connector = new SQLConnector(SQLServer, txtUserName.Text, txtPassWord.Text);
            }

            if (!connector.CheckConnection())
            {
                MessageBox.Show("Please check your information filled");
                btnTestConnect.Text = "Test Connection";
                return;
            }
            DataTable catelog = connector.GetCatalogList();

            txtCatalog.DataSource    = catelog;
            txtCatalog.DisplayMember = "name";
            txtCatalog.Enabled       = true;
        }