Untitled

mail@pastecode.io avatar
unknown
csharp
4 years ago
1.0 kB
4
Indexable
Never
namespace Arama_DataGrid
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        MySqlConnection VT_BAGLANTI = new MySqlConnection("Data Source=localhost;Database=arama_datagrid;port=3306;user=root;password=171717");

        private void Form1_Load(object sender, EventArgs e)
        {
            searchData("");
        }
        

        private void txt_Arama_TextChanged(object sender, EventArgs e)
        {
            searchData(txt_Arama.Text);
        }

        public void searchData(string valueToFind)
        {
            string arama_sorgusu = "SELECT * FROM  musteri WHERE CONCAT(AD,'', SOYAD, '' , TCNO, '', ILCE, '', SEHIR) LIKE '%" + valueToFind + "%'";
            MySqlDataAdapter adaptor = new MySqlDataAdapter(arama_sorgusu, VT_BAGLANTI);
            DataTable tablo = new DataTable();
            adaptor.Fill(tablo);
            dgv_Liste.DataSource = tablo;
        }
    }
}