[Mono-list] asking for null DataSet

Carlos Ble carlosble at shidix.com
Thu Oct 27 03:42:48 EDT 2005


Thanks Gayan.

El jue, 27-10-2005 a las 09:09 +0600, Gayan Perera escribió:
> dear frnd,
> as to my knowlage yes you can and if you don't have any other option
> this will be what you have to use :D
> 
> best regards,
> Gayan.
> 
> On 10/27/05, Carlos Ble <carlosble at shidix.com> wrote:
>         Hi
>         I tried to ask for a null DataSet to determine when a SELECT
>         query
>         return nothing. DataSet are filled with NpgsqlDataAdapter.Fill
>         method.
>         This method never returns null. So you can't ask
>         if (dataset == null). 
>         Searching for DataSet.Tables property I found this from msdn:
>         A DataRowCollection that contains DataRow objects; otherwise a
>         null
>         value if no DataRow objects exist.
>         http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdatadatatableclassrowstopic.asp
>         
>         So I tried with dataset.Tables == null but isn't null, because
>         in
>         DbDataAdapter, an empty table with real name extracted from
>         SetupSchema 
>         are added to dataset.
>         The solution is to ask
>         if (dataset.Tables[0].Rows.Count == 0)
>         
>         Is this a good mechanism?
>         Could this code run in .Net too?
>         
>         
>         
>         
>         
>         
>         
>         
>         
>         
>         
>         _______________________________________________ 
>         Mono-list maillist  -  Mono-list at lists.ximian.com
>         http://lists.ximian.com/mailman/listinfo/mono-list
> 



More information about the Mono-list mailing list