27-04-2020, 13:13
TC Kimlik no girilerek veri tabanımdaki bilgileri getiriyorum. Ancak ad, soyad ve cinsiyet kriteleri ile arama yapamıyorum.
"or" kullandım olmadı "+" kullandım yine olmadı.
where TCKimlikNo='" + txtTCKimlikNo.Text + "' or Ad like '%" + txtAd.Text + "%' or Soyad like '%" + txtSoyad.Text + "%'
where TCKimlikNo='" + txtTCKimlikNo.Text + "' + Ad like '%" + txtAd.Text + "%' + Soyad like '%" + txtSoyad.Text + "%'
Bu şekilde denedim başaramadım.
"or" kullandım olmadı "+" kullandım yine olmadı.
where TCKimlikNo='" + txtTCKimlikNo.Text + "' or Ad like '%" + txtAd.Text + "%' or Soyad like '%" + txtSoyad.Text + "%'
where TCKimlikNo='" + txtTCKimlikNo.Text + "' + Ad like '%" + txtAd.Text + "%' + Soyad like '%" + txtSoyad.Text + "%'
Bu şekilde denedim başaramadım.
Visual Basic
- private void btnAra_Click(object sender, EventArgs e)
- {
- try
- {
- baglantim.Open();
- OleDbDataAdapter arama=new OleDbDataAdapter("select TCKimlikNo, Ad, Soyad, Cinsiyet from tblPersonel where TCKimlikNo='" + txtTCKimlikNo.Text + "'", baglantim);
- DataSet dshafiza = new DataSet();
- arama.Fill(dshafiza);
- dataGridView1.DataSource = dshafiza.Tables[0];
- baglantim.Close();
- }
- catch (Exception hatamsj)
- {
-
- MessageBox.Show(hatamsj.Message);
- baglantim.Close();
- }
-
-
- }