Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Return either dataset or integer from function
Message
De
26/04/2004 11:02:46
Nancy Folsom
Pixel Dust Industries
Washington, États-Unis
 
 
À
25/04/2004 12:00:33
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
00892206
Message ID:
00898179
Vues:
20
>Hey Nancy,
>
>>Also, you might consider whether it makes sense to throw an exception if no matches are found instead of just setting the DataSet to null.
>
>Actually, I wouldn't do either. If no matches were found, and your DataSet still exists (IOW, don't set it to null), then you'll simply not have any rows in your DataSet. Depending on what you're doing with the returned DataSet, that may make more sense from a coding standpoint (DataBinding to a table with no rows in it most likely will require no additional coding, the stuff in the UI will simply be empty). Obviously though, it depends on what you're doing (your example of a Login attempt is probably better dealt with by an exception rather than an empty DataSet).

I assumed though, that wasn't the situation in this case since Chris was setting it null. But, yes, of course, it may make sense to have an empty dataset in some situations. Thanks for adding that important detail.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform