pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Detecting a Null field on an NpgsqlDataReader object
4+ messages / 2 participants
[nested] [flat]

* Detecting a Null field on an NpgsqlDataReader object
@ 2010-08-03 15:25  Oliveiros d'Azevedo Cristina <oliveiros.cristina@marktest.pt>
  0 siblings, 1 reply; 4+ messages in thread

From: Oliveiros d'Azevedo Cristina @ 2010-08-03 15:25 UTC (permalink / raw)
  To: pgsql-interfaces

Dear All,

How can I detect if a certain field of a record returned by a query is NULL ?

I'm sure there must be a direct way of doing this, but I googled up and down, back and forth and was unable to find out.

For ex, in Sql Server we just compare with DbNull singleton. 

What is the equivalent in Npgsql?

Thanks a million for your help

Best,
Oliveiros d'Azevedo Cristina

^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Detecting a Null field on an NpgsqlDataReader object
@ 2010-08-03 16:32  Francisco Figueiredo Jr. <francisco@npgsql.org>
  parent: Oliveiros d'Azevedo Cristina <oliveiros.cristina@marktest.pt>
  0 siblings, 1 reply; 4+ messages in thread

From: Francisco Figueiredo Jr. @ 2010-08-03 16:32 UTC (permalink / raw)
  To: Oliveiros d'Azevedo Cristina <oliveiros.cristina@marktest.pt>; +Cc: pgsql-interfaces

On Tue, Aug 3, 2010 at 12:25, Oliveiros d'Azevedo Cristina
<oliveiros.cristina@marktest.pt> wrote:
> Dear All,
>

Hi!

> How can I detect if a certain field of a record returned by a query is NULL
> ?
>
> I'm sure there must be a direct way of doing this, but I googled up and
> down, back and forth and was unable to find out.
>
> For ex, in Sql Server we just compare with DbNull singleton.
>
> What is the equivalent in Npgsql?
>

You can use the same way. Npgsql uses DBNull singleton to express null values.
If you are trying to check in the NpgsqlDataReader, you will need to
use the method IsDBNull(int)

I hope it helps.


-- 
Regards,

Francisco Figueiredo Jr.
Npgsql Lead Developer
http://www.npgsql.org
http://fxjr.blogspot.com
http://twitter.com/franciscojunior



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Detecting a Null field on an NpgsqlDataReader object
@ 2010-08-03 16:46  Oliveiros d'Azevedo Cristina <oliveiros.cristina@marktest.pt>
  parent: Francisco Figueiredo Jr. <francisco@npgsql.org>
  0 siblings, 1 reply; 4+ messages in thread

From: Oliveiros d'Azevedo Cristina @ 2010-08-03 16:46 UTC (permalink / raw)
  To: francisco@npgsql.org; +Cc: pgsql-interfaces

Olá!

>> For ex, in Sql Server we just compare with DbNull singleton.
>>
>> What is the equivalent in Npgsql?
>>
>
> You can use the same way. Npgsql uses DBNull singleton to express null 
> values.
> If you are trying to check in the NpgsqlDataReader, you will need to
> use the method IsDBNull(int)
>
> I hope it helps.
>
>

Oh, I see.
All in all it's the same mechanism .
Yes, I'm indeed trying to check in a NpgsqlDataReader.
I'll give that method a try.



Obrigado,
Oliveiros 




^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Detecting a Null field on an NpgsqlDataReader object
@ 2010-08-05 14:01  Francisco Figueiredo Jr. <francisco@npgsql.org>
  parent: Oliveiros d'Azevedo Cristina <oliveiros.cristina@marktest.pt>
  0 siblings, 0 replies; 4+ messages in thread

From: Francisco Figueiredo Jr. @ 2010-08-05 14:01 UTC (permalink / raw)
  To: Oliveiros d'Azevedo Cristina <oliveiros.cristina@marktest.pt>; +Cc: pgsql-interfaces

On Tue, Aug 3, 2010 at 13:46, Oliveiros d'Azevedo Cristina
<oliveiros.cristina@marktest.pt> wrote:
> Olá!
>

Olá! Tudo bem?

>>> For ex, in Sql Server we just compare with DbNull singleton.
>>>
>>> What is the equivalent in Npgsql?
>>>
>>
>> You can use the same way. Npgsql uses DBNull singleton to express null
>> values.
>> If you are trying to check in the NpgsqlDataReader, you will need to
>> use the method IsDBNull(int)
>>
>> I hope it helps.
>>
>>
>
> Oh, I see.
> All in all it's the same mechanism .
> Yes, I'm indeed trying to check in a NpgsqlDataReader.
> I'll give that method a try.
>

If you need any help, please let us know.

>
>
> Obrigado,

De nada!


-- 
Regards,

Francisco Figueiredo Jr.
Npgsql Lead Developer
http://www.npgsql.org
http://fxjr.blogspot.com
http://twitter.com/franciscojunior



^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2010-08-05 14:01 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2010-08-03 15:25 Detecting a Null field on an NpgsqlDataReader object Oliveiros d'Azevedo Cristina <oliveiros.cristina@marktest.pt>
2010-08-03 16:32 ` Francisco Figueiredo Jr. <francisco@npgsql.org>
2010-08-03 16:46   ` Oliveiros d'Azevedo Cristina <oliveiros.cristina@marktest.pt>
2010-08-05 14:01     ` Francisco Figueiredo Jr. <francisco@npgsql.org>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox