private void button1_Click(object sender, EventArgs e)
{
SqlConnection conn = new SqlConnection(@"Data Source=.;Initial Catalog=sa;Integrated Security=True");
conn.Open();
SqlCommand liste = new SqlCommand("select * from isci", conn);
SqlDataAdapter da = new SqlDataAdapter(liste);
DataTable dt = new DataTable();
da.Fill(dt);
dataGridView1.DataSource = dt;
conn.Close();
}
private void button2_Click(object sender, EventArgs e)
{
SqlConnection conn = new SqlConnection(@"Data Source=.;Initial Catalog=sa;Integrated Security=True");
conn.Open();
SqlCommand ekle = new SqlCommand($"Insert into isci (isim,maas) values (@pisim,@pmaas)", conn);
ekle.Parameters.AddWithValue(@"pisim", textBox1.Text);
ekle.Parameters.AddWithValue(@"maas", (textBox2.Text).ToString());
ekle.ExecuteNonQuery();
conn.Close();
}
}