Exemple #1
0
        private void btBack_Click_1(object sender, EventArgs e)
        {
            AvtorizationForm avtorizationForm = new AvtorizationForm();

            avtorizationForm.Show();
            this.Hide();
        }
Exemple #2
0
        private void btConnect_Click(object sender, EventArgs e)
        {
            string connStr = "";

            if (comboBoxConnect.Text == "По подлинности Windows")
            {
                connStr     = "Data Source=" + tbServer.Text + ";Initial Catalog=" + tbDB.Text + ";Integrated Security=True";
                ConnDB.conn = connStr;
            }
            if (comboBoxConnect.Text == "По подлинности SQL Server")
            {
                connStr     = "Data Source =" + tbServer.Text + "; Initial Catalog =" + tbDB.Text + "; Integrated Security = SSPI; User ID =" + tbUser.Text + "; Password ="******"Подключение не удалось!");
                }
                finally
                {
                    if (myConnection.State == ConnectionState.Open)
                    {
                        myConnection.Close();
                    }
                }
            }
        }