C#nedir?com Homepage
Forum Home Forum Home > C# / .NET > Visual C#
  New Posts New Posts RSS Feed - How can I make a data call button with SqlCommand
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

How can I make a data call button with SqlCommand

 Post Reply Post Reply
   

Author
Message
ahmet_ronas View Drop Down
Newbie
Newbie


Joined: 04 Şubat 2020
Location: Turkey
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote ahmet_ronas Quote  Post ReplyReply Direct Link To This Post Topic: How can I make a data call button with SqlCommand
    Posted: 04 Şubat 2020 at 21:08
 I did it this way, but it doesn't work fully. Where am I making a mistake?



  SqlCommand komut = new SqlCommand("Select * from Tbl_davalar employee where " +

            "(Dosyano like '%' + @p1  + '%' or Dosyano is null) and " +
            "(davadurum like '%' + @p2 + '%' or davadurum is null) and  " +
            "(esasyil like '%' + @p3 + '%' or esasyil is null) and " +
            "(esasno like '%' + @p4 + '%' or esasno is null) and " +
            "(davaci like '%' + @p5 + '%' or davaci is null) and  " +
            "(davali like '%' + @p6 + '%' or davali is null) and " +
            "(davakonusu like '%' + @p7 + '%'  or davakonusu is null) and " +
            "(dosyaturu like '%' + @p8 + '%' or dosyaturu is null) and " +
            "(mahkemeadi like '%' + @p9 + '%' or mahkemeadi is null) and " +
            "(tem like '%' + @p10 + '%' or tem is null) and " +
            "(aciklama like '%' + @p11 + '%' or aciklama is null) and " +
            "(tcdavaci like '%' + @p12 + '%' or tcdavaci is null) and " +
            "(tcdavali like '%' + @p13 + '%' or tcdavali is null) and " +
            "(eskiesasyil like '%' + @p14 + '%' or eskiesasyil is null) and " +
            "(eskiesasno like '%' + @p15 + '%' or eskiesasno is null) and " +
            "(avukat like '%' + @p16 + '%') and " +
            "(tebligtarihi like '%' + @p17 + '%' or tebligtarihi is null) and" +
            "(davasonucu like '%' + @p18 + '%' or davasonucu is null) order by dosyano asc ", bgl.baglanti());


            komut.Parameters.AddWithValue("@p1", TxtDosyaNo.Text);
            komut.Parameters.AddWithValue("@p2", CmbDosyaDurumu.Text);
            komut.Parameters.AddWithValue("@p3", CmbEsasYil.Text);
            komut.Parameters.AddWithValue("@p4", TxtEsasNo.Text);           
            komut.Parameters.AddWithValue("@p5", CmbDavaci.Text);
            komut.Parameters.AddWithValue("@p6", CmbDavali.Text);
            komut.Parameters.AddWithValue("@p7", CmbDavaKonusu.Text);
            komut.Parameters.AddWithValue("@p8", CmbMahkemeAdi.Text);
            komut.Parameters.AddWithValue("@p9", CmbOnamaDurumu.Text);
            komut.Parameters.AddWithValue("@p10", rchaciklama.Text);
            komut.Parameters.AddWithValue("@p11", TxtDavaciTc.Text);
            komut.Parameters.AddWithValue("@p12", TxtDavaliTc.Text);
            komut.Parameters.AddWithValue("@p13", CmbEskiEsasYil.Text);
            komut.Parameters.AddWithValue("@p14", TxtEskiEsasNo.Text);
            komut.Parameters.AddWithValue("@p15", CmbAvukat.Text);
            komut.Parameters.AddWithValue("@p16", MskTebligTarihi.Text);
            komut.Parameters.AddWithValue("@p17", CmbDavaSonucu.Text);
            komut.Parameters.AddWithValue("@p18", CmbDosyaTuru.Text);


            SqlDataAdapter da = new SqlDataAdapter(komut);
            DataTable dt = new DataTable();
            da.Fill(dt);
                                


            SqlDataReader dr = komut.ExecuteReader();

            if (dr.Read())
            {
                dataGridView2.DataSource = dt;
            }

            else
            {
                MessageBox.Show("Aradığınız Kriterlere Uygun Dosya Bulunamadı !", "Uyarı");
            }
            bgl.baglanti().Close();

@#^^^€+
Back to Top
 Post Reply Post Reply
  Share Topic   
   


Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.01
Copyright ©2001-2014 Web Wiz Ltd.