15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


Dao assigns -9.123E+19 on double field if field is NULL

Jim Leavitt -- jimll@halcyon.com
Tuesday, September 24, 1996

Environment: VC++ 4.2, WinNT 4.0

Hi:

Visual C++ 4.2
Beta 4.2a Update
Windows NT 4.0 Release version
Pentium Pro processor(s)

Well this could be my problem... I've got an application nearly finished
using dao recordsets, etc. I've now found that null double fields in queries or from imported
data are assigned the value -9.123E+19. 

I searched the KB and found Q125465 that shows this used to be a problem with SINGLE 
values in VC 1.51 and 1.52. They explain a fix, however this is all supposed to be OK in 4.2.

My workaround has been to check for the value -9.123E+19 in all double fields returned from
queries or tables and then update them to 0.0. The problem is I've only got half a ton of recordsets
to work on. This MUST be the wrong fix.

Can anyone shed any light on this problem. 
(Incidentally, all the queries work fine under Access 7.0
returning NULL fields back to the record list display. 
I think I'm having the problem in 
DoFieldExchange(CDaoFieldExchange* pFX), generated by class wizard.)

Thanks a lot,
Jim Leavitt
jimll@halcyon.com





Jim Leavitt -- jimll@halcyon.com
Thursday, September 26, 1996

[Mini-digest: 2 responses]

Environment: VC++ 4.2, WinNT 4.0

In my last post, I complained about a dao problem that put -9.123E+19 into any null
double fields in a CDaoRecordset. It's my own bonehead mistake...

I was calling...   m_Recordset.m_Double_Field = NULL   when importing a null value.
It turns out that I needed to call SetFieldNull(&(m_Recordset.m_Double_Field))

Apologies for cluttering the list...
Jim Leavitt

----------

>Hi:
>
>Visual C++ 4.2
>Beta 4.2a Update
>Windows NT 4.0 Release version
>Pentium Pro processor(s)
>
>Well this could be my problem... I've got an application nearly finished
>using dao recordsets, etc. I've now found that null double fields in queries or from imported
>data are assigned the value -9.123E+19. 
>
>I searched the KB and found Q125465 that shows this used to be a problem with SINGLE 
>values in VC 1.51 and 1.52. They explain a fix, however this is all supposed to be OK in 4.2.
>
>My workaround has been to check for the value -9.123E+19 in all double fields returned from
>queries or tables and then update them to 0.0. The problem is I've only got half a ton of recordsets
>to work on. This MUST be the wrong fix.
>
>Can anyone shed any light on this problem. 
>(Incidentally, all the queries work fine under Access 7.0
>returning NULL fields back to the record list display. 
>I think I'm having the problem in 
>DoFieldExchange(CDaoFieldExchange* pFX), generated by class wizard.)
>
>Thanks a lot,
>Jim Leavitt
>jimll@halcyon.com



-----From: Erik van der Goot 

Hi,

Ok, I may have misunderstood the problem, but ...

The value you are getting is in fact defined in AFXDB_.H

#define AFX_RFX_DOUBLE_PSEUDO_NULL (-9.123e19)

If your database contains NULL values you want to be told about it. 
You do realise that NULL is not the same as 0.0??

So, what you are seeing is completely correct and not a bug that needs
fixing. NULL means NO DATA, which is rather different from 0.0.


Ciao

Erik





| Вернуться в корень Архива |