SqlConnection baglanti = new SqlConnection(@"Data Source = HALLSTEIN\SQLEXPRESS; Initial Catalog = kitap; Integrated Security = True");
SqlCommand komut = new SqlCommand();
private **** button1_Click(object sender, EventArgs e)
{
try
{
kitapDataSet ds = new kitapDataSet();
if (baglanti.State == ConnectionState.Closed) baglanti.Open();
ds.Clear();
SqlCommand komut = new SqlCommand("INSERT INTO veri(OgNo,Adi,Soyadi,Sehir) Values ('" + textBox1.Text + "','" + textBox2.Text + "','" + textBox3.Text + "','" + textBox4.Text + "')baglanti");
komut.ExecuteNonQuery();
dataGridView1.Update();
baglanti.Close();
MessageBox.Show("Kayıt eklendi");
}
catch (Exception hata)
{
MessageBox.Show(hata.Message);
}
}
SqlCommand komut = new SqlCommand();
private **** button1_Click(object sender, EventArgs e)
{
try
{
kitapDataSet ds = new kitapDataSet();
if (baglanti.State == ConnectionState.Closed) baglanti.Open();
ds.Clear();
SqlCommand komut = new SqlCommand("INSERT INTO veri(OgNo,Adi,Soyadi,Sehir) Values ('" + textBox1.Text + "','" + textBox2.Text + "','" + textBox3.Text + "','" + textBox4.Text + "')baglanti");
komut.ExecuteNonQuery();
dataGridView1.Update();
baglanti.Close();
MessageBox.Show("Kayıt eklendi");
}
catch (Exception hata)
{
MessageBox.Show(hata.Message);
}
}

