komut.CommandText = "select * from kitaplar where Barkod like" +"'" + "%" + barkodTb.Text + "%" + "'";
while (oku.Read())
{
if (oku["Barkod"].ToString() == barkodTb.Text)
{
MessageBox.Show("Bu barkoda halihazırda" + " " + oku["KitapAdi"].ToString() + " " + oku["SayfaSayi"].ToString() + " " +
oku["Yazari"].ToString() + " Bilgili kitap kayıtlı");
oku.Close();
barkodTb.Text = "";
break;
}
else
{
oku.Close();
komut.CommandText = "insert into kitaplar (Barkod,KitapAdi,SayfaSayi,Yazari) values ('" + barkodTb.Text + "','" +
kitapAdiTb.Text + "','" + sayfaTb.Text + "','" + yazarTb.Text + "')";
komut.ExecuteNonQuery();
MessageBox.Show(barkodTb.Text + " " + kitapAdiTb.Text + " " + sayfaTb.Text + " " + yazarTb.Text + " Bilgili kitap kaydı yapıldı");
}
}