private void Refresh1(int a, DateTime b, DateTime c) { try { Sorgular sorgu = new Sorgular(); SqlConnection myconnection = new SqlConnection("Data Source=DESKTOP-G51H1QD\\SQLEXPRESS;Initial Catalog=DatabaseManagementProject;Integrated Security=True;Connect Timeout=15;Encrypt=False;TrustServerCertificate=False"); myconnection.Open(); SqlCommand sorgu1 = new SqlCommand(); sorgu1.Connection = myconnection; sorgu1.CommandType = CommandType.StoredProcedure; sorgu1.CommandText = "sp_GosterCalisanBolum"; sorgu1.Parameters.AddWithValue("@Bid", a); sorgu1.Parameters.AddWithValue("@Tarih1", b); sorgu1.Parameters.AddWithValue("Tarih2", c); SqlDataAdapter myAdaptor = new SqlDataAdapter(sorgu1); DataTable dt = new DataTable(); myAdaptor.Fill(dt); dataGridView1.DataSource = dt; dataGridView1.Refresh(); myconnection.Close(); } catch (Exception e) { MessageBox.Show(e.ToString(), "Hata Kod:11", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void Arama(int Pid) { try { Sorgular sorgu = new Sorgular(); string[] a = new string[11]; for (int i = 0; i < 11; i++) { a[i] = MydataGridView.Rows[Pid - 1].Cells[i].Value.ToString(); } TC_txtbox.Text = a[0]; isim_txtbox.Text = a[1]; soyisim_txtbox.Text = a[2]; if (a[3] == "E") { Cinsiyet_Cbox.SelectedIndex = 0; } else { Cinsiyet_Cbox.SelectedIndex = 1; } dateTimePicker_Dtarih.Text = a[4]; Adres_txtbox.Text = a[5]; Mail_txtbox.Text = a[6]; Tel_txtbox.Text = a[7]; string Ust; Ust = sorgu.sp_findUstUnvan(a[10]); bool bitti = false; int j = 0; int a1 = 0; int a2 = 0; int a3 = 0; while (bitti == false) { if (a1 == 0) { Meslek_Cbox.SelectedIndex = j; } if (a2 == 0) { Bolum_Cbox.SelectedIndex = j; } if (a3 == 0) { Unvan_Cbox.SelectedIndex = j; } if (Meslek_Cbox.SelectedItem.ToString() == a[8]) { if (a1 == 0) { Meslek_Cbox.SelectedIndex = j; } a1 = 1; } if (Bolum_Cbox.SelectedItem.ToString() == a[9]) { if (a2 == 0) { Bolum_Cbox.SelectedIndex = j; } a2 = 1; } if (Unvan_Cbox.SelectedItem.ToString() == Ust) { if (a3 == 0) { Unvan_Cbox.SelectedIndex = j; } a3 = 1; } if (a1 * a2 * a3 == 1) { bitti = true; } else { j++; } } j = 0; while (bitti == true) { Altu_Cbox.SelectedIndex = j; if (Altu_Cbox.SelectedItem.ToString() == a[10]) { bitti = false; } else { j++; } } } catch (Exception g) { MessageBox.Show(g.ToString(), "Hata Kod:19", MessageBoxButtons.OK, MessageBoxIcon.Error); } }