private void BtnKaydet_Click(object sender, EventArgs e) { if (pnlSetup.CanNullsCheck()) { ArsLibrary.SaveLineCFG("DBServerName", SERVER.GetDataStr()); ArsLibrary.SaveLineCFG("DBUserName", DB_KULLANICI_ADI.GetDataStr()); ArsLibrary.SaveLineCFG("DBPassword", DB_SIFRE.GetDataStr()); ArsLibrary.SaveLineCFG("DBName", "master"); ArsLibrary.dbServerName = SERVER.GetDataStr(); ArsLibrary.dbUserName = DB_KULLANICI_ADI.GetDataStr(); ArsLibrary.dbPassword = DB_SIFRE.GetDataStr(); ArsLibrary.dbName = "master"; ArsMessage.ShowMessage("Bilgi", "Kayıt Tamamlandı"); if (girisForm != null) { girisForm.Size = new Size(480, 300); } Close(); } else { ArsMessage.ShowMessage("Hata", "Lütfen veritabanı Bağlantısı İçin Gerekli Bilgileri Doldurunuz."); } }
private void DB_SIFRE_ArsExit(object sender, EventArgs e) { if (DB_SIFRE.IsNotEmpty()) { if (ArsLibrary.activeForm != null) { using (ArsProgress frm = new ArsProgress(DBConnectionCheck)) { frm.activeForm = ArsLibrary.activeForm; frm.ShowDialog(); } } } }
private void DBConnectionCheck() { try { SqlConnection conn = new SqlConnection("Data Source=" + SERVER.Text + "; Initial Catalog=master; User Id=" + DB_KULLANICI_ADI.Text + "; password="******";"); conn.Open(); SqlCommand command = new SqlCommand("SELECT NAME FROM MASTER.SYS.DATABASES", conn); DataTable dataTable = new DataTable(); SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(command); sqlDataAdapter.Fill(dataTable); sqlDataAdapter.Dispose(); } catch (Exception ex) { ArsMessage.ShowMessage("Hata", ex.Message); DB_SIFRE.Focus(); } }