Şimdi yapmak istediğim şey şu:
e-okul uygulaması yapıyorum csharp ta ama öğrenci girişi kısmında öğrenci numarasını yazıp girip notlarına sorunsuz bakıyor ama
yanlış bi numara girince hata vermiyo boş textboxlar geliyo
bunu nasıl düzeltiriz? try
{
int bul;
bul = int.Parse(textBox1.Text);
OleDbCommand ara = new OleDbCommand("Select * from tablo1 where num = " + bul + "", baglanti);
OleDbDataReader oku = null;
baglanti.Open();
oku = ara.ExecuteReader();
while (oku.Read())
{
ListViewItem kayit = new ListViewItem(oku["num"].ToString());
label4.Text = oku["num"].ToString();
label5.Text = oku["sinif"].ToString();
textBox4.Text = oku["y1"].ToString();
textBox5.Text = oku["y2"].ToString();
textBox6.Text = oku["s1"].ToString();
textBox7.Text = oku["ort"].ToString();
label2.Text = oku["ad"].ToString();
label3.Text = oku["soy"].ToString();
double ort = Convert.ToDouble(oku["ort"]);
if (ort > 45)
textBox8.Text = "Geçti";
else if (ort < 45)
textBox8.Text = "Kaldı";
}
oku.Close();
baglanti.Close();
}
catch
{
MessageBox.Show("Böyle bi öğrenci Yok");
Form1 frm1 = new Form1();
this.Hide();
frm1.Show();
}