Sanırsam ne demek istediğim bu şekilde anlaşılacak...
bool durum;
void mukerrerkontrol(int duzenlenen_id)
{
SQLiteConnection baglanti = new SQLiteConnection("Data Source = DB.db");
baglanti.Open();
SQLiteCommand komut = new SQLiteCommand("select * from veritabani where adisoyadi=@adisoyadi AND numara=@numara AND id not in ("+duzenlenen_id.toString()+")", baglanti);
komut.Parameters.AddWithValue("@adisoyadi", txtaad.Text);
komut.Parameters.AddWithValue("@numara", numara.Text);
SQLiteDataReader dr = komut.ExecuteReader();
if (dr.Read())
{
durum = false;
}
else
{
durum = true;
}
baglanti.Close();
}
-------------
private void DUZENLE_BUTONU(object sender, EventArgs e)
{
mukerrerkontrol(Convert.ToInt32(txtid.Text));
if (durum == true)
{
if (txtaad.Text == "") // HANESİ BOŞ GEÇİLEMEZ
{
MessageBox.Show("İsim boş geçilemez.", "BİLGİ", MessageBoxButtons.OK, MessageBoxIcon.Information);
txtaad.Focus();
}
else if (txtdogumt.Text == "") // HANESİ BOŞ GEÇİLEMEZ
{
MessageBox.Show("Dogum Tarihi", "BİLGİ", MessageBoxButtons.OK, MessageBoxIcon.Information);
txtdogumt.Focus();
}
else if (numara.Text == "") // HANESİ BOŞ GEÇİLEMEZ
{
MessageBox.Show("Numara boş geçilemez.", "BİLGİ", MessageBoxButtons.OK, MessageBoxIcon.Information);
numara.Focus();
}
else
{
baglanti = new SQLiteConnection("Data Source = DB.db");
string sorgu = "UPDATE veritabani SET id=@id,adisoyadi=@adisoyadi,dogumtarihi=@dogumtarihi,numara=@numara WHERE id=@id";
komut = new SQLiteCommand(sorgu, baglanti);
komut.Parameters.AddWithValue("@id", Convert.ToInt32(txtid.Text));
komut.Parameters.AddWithValue("@adisoyadi", txtaad.Text);
komut.Parameters.AddWithValue("@dogumtarihi", txtdogumt.Text);
komut.Parameters.AddWithValue("@numara", numara.Text);
baglanti.Open();
komut.ExecuteNonQuery();
baglanti.Close();
MessageBox.Show(txtaad.Text + " İSİMLİ KİŞİNİN KAYDI GÜNCELLENDİ", "KAYIT GÜNCELLENDİ", MessageBoxButtons.OK, MessageBoxIcon.Information);
this.Close();
}
}
else
{
MessageBox.Show(numara.Text + " .Numara " + aad.Text + " Başka Bir Kişiye Ait " + "\n" + "KAYIT YAPAMAZSINIZ", "MÜKKERRER KAYIT UYARISI", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
}