Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Selecting by group with null support
Message
De
21/09/2015 03:50:15
 
 
À
20/09/2015 09:45:42
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
Environment:
VB 9.0
OS:
Windows 8.1
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01624841
Message ID:
01624861
Vues:
49
This message has been marked as the solution to the initial question of the thread.
>I have this command to select only the groups from a datatable:
>
>
>' Group
>loResult = loDataTable.AsEnumerable().GroupBy(Function(r) r.Field(Of Integer)(lcPrimaryKey)).[Select](Function(g) g.First()).CopyToDataTable
>
>
>I just found out that this will generate an error if one of the values is a null.
>
>Is there a way I can add support in this command for such situation?

See you no longer need it but this should work:
loResult = loDataTable.AsEnumerable().GroupBy(Function(r) r.Field(Of System.Nullable(Of Integer))(lcPrimaryKey)).[Select](Function(g) g.First()).CopyToDataTable
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform