datatable.defaultview.rowfilter is not working repeatedly when calling my function in c#

Saravanaavignesh sana 1 Reputation point
2022-04-26T16:00:13.06+00:00
Button click {
                      SQL Query1 ..
                      Getdata( Query1);
                   }

 bool Getdat(string Query)
      {
        using (SqlConnection connection = new SqlConnection(connetionString))
            {

                    connection.Open();
                    SqlDataReader rdr;
                    SqlCommand cmd = new SqlCommand(Query, connection);
                    cmd.CommandType = CommandType.StoredProcedure;


                    rdr = cmd.ExecuteReader();


                    dtvehiclegetdat.Reset();

                    dtvehiclegetdat.Load(rdr);

                    dtcbosearch_vehicle = dtvehiclegetdat.DefaultView.ToTable(true, "Column1", "Column2");

      return true;
                }

"dtvehiclegetdat.DefaultView.ToTable(true, "Column1", "Column2"); "it is filter correct order in first time, but next time it is passing empty rows to datable

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,294 questions
{count} votes