Ver Mensaje Individual
  #2 (permalink)  
Antiguo 17/12/2009, 15:20
Avatar de Porlachucha
Porlachucha
 
Fecha de Ingreso: noviembre-2008
Ubicación: Santiago
Mensajes: 172
Antigüedad: 15 años, 6 meses
Puntos: 5
Respuesta: Ayuda aplicar DISTINCT a DataSet

usa esta funcion (esta en c#)

Código:
        public static DataTable dttSelectDistinct(DataTable SourceTable, params string[] Columns)
        {
            DataTable Result = new DataTable();
            if (SourceTable != null)
            {
                DataView DView = SourceTable.DefaultView;
                try
                {
                    DView.RowFilter = null;
                    Result = DView.ToTable(true, Columns);
                }
                catch (Exception ex)
                {
                    string errMessage = "";
                    for (Exception tempException = ex; tempException != null; tempException = tempException.InnerException)
                    {
                        //errMessage += new SGS.CFG.Functions().preparaMsgError(tempException.Message);
                    }
                }

            }
            return Result;
        }
como parametros le pasas un datatable con los datos a filtrar, y un arreglo de string, con las columnas que quieres que se le aplique el distinct
espero te sirva
salu2
PLCH
__________________
Nada mas patetico que "detestar" a Intel o Microsoft o Windows o Apple ... apuesto que eres el tipico teton espinilluo y pajero que usa Linux para sentirse capo ...