- Katılım
- 5 Nisan 2020
- Mesajlar
- 2.816
- Çözümler
- 11
Daha fazla
- Cinsiyet
- Erkek
- Meslek
- Sivil Polis
C#:
private void button1_Click(object sender, EventArgs e)
{
SqlConnection baglanti = null ;
try
{
baglanti = new SqlConnection(@"RESS;Initial Catalog=OrnekUygulama;Integrated Security=True");
baglanti.Open();
SqlCommand sqlKomut = new SqlCommand("select OgrenciID,OgrenciAdi,Not1,Not2 from OrnekUygulama ");
SqlDataReader SqlDR = sqlKomut.ExecuteReader();
while (SqlDR.Read())
{
string id = SqlDR[0].ToString();
string OgrenciAdi = SqlDR[1].ToString();
string not1 = SqlDR[2].ToString();
string not2 = SqlDR[3].ToString();
richTextBox1.Text = id + " " + OgrenciAdi + " " + "Not1:" + not1 + " " + "Not2:" + not2;
}
}
catch (Exception ex)
{
MessageBox.Show("SQL Query sırasında hata oluştu!" + ex.ToString());
}
finally
{
if (baglanti != null)
{
baglanti.Close();
}
}
}
}
}
Kodlarım şu şekilde ancak yine de hata alıyorum. Sorun ne? VS kodları bu koddakiler.