private void dataGridView1_CellEnter(object sender, DataGridViewCellEventArgs e)
{
txtHastaNO.Text = dataGridView1.CurrentRow.Cells[0].Value.ToString();
txtAdi.Text = dataGridView1.CurrentRow.Cells[1].Value.ToString();
txtSoyadi.Text = dataGridView1.CurrentRow.Cells[2].Value.ToString();
txtKimlik.Text = dataGridView1.CurrentRow.Cells[3].Value.ToString();
dateTimePicker1.Value = DateTime.Parse(dataGridView1.CurrentRow.Cells[4].Value.ToString());
txtRahatsizlik.Text = dataGridView1.CurrentRow.Cells[5].Value.ToString();
}
private void btnKaydet_Click(object sender, EventArgs e)
{
string sorgu = "INSERT INTO tablo_1(ad,soyad,tc_kimlik,rahatsizlik,dttarih) VALUES (@ad,@soyad,@tc_kimlik,@rahatsizlik,@dttarih)";
komut = new SqlCommand(sorgu, baglanti);
komut.Parameters.AddWithValue("@ad", txtAdi.Text);
komut.Parameters.AddWithValue("@soyad", txtSoyadi.Text);
komut.Parameters.AddWithValue("@tc_kimlik", txtKimlik.Text);
komut.Parameters.AddWithValue("@rahatsizlik", txtRahatsizlik.Text);
komut.Parameters.AddWithValue("@dttarih", dateTimePicker1.Value);
baglanti.Open();
komut.ExecuteNonQuery();
baglanti.Close();
HastaGetir();