May 14, 2014

DataTable Distinct in C#

  if (result.Rows.Count > 0)
            {
                //convert DataTable to DataView
                DataView dv = result.DefaultView.Copy();
                //apply the sort on CustomerSurname column
                dv.Filter= "ProductID = '"+productid+"'";
                //save our newly ordered results back into our datatable
                result = dv.ToTable(true,columDistinct);
            }

0 comments:

Post a Comment

Nam Le © 2014 - Designed by Templateism.com, Distributed By Templatelib