NULL INT field gives strange value in CRecordset class. 
Author Message
 NULL INT field gives strange value in CRecordset class.

Hi,

My software uses a MFC CRecordset derived class.

Occasionally when I am doing a query 2 integer fields have strange
values. It seems that in the Database Table they are NULL. I'm accessing
them as a long in my MFC code, they are integers in the actual table.

The values are both '1246576928' (they should be 5 digits) - I had
assumed that NULL values in the database table would translate as 0 in
the member of the CRecordset class.

How do I tell in my MFC class when I'm getting a NULL value? It would be
hard to replace all NULL values in the table with 0 as there are many
tables involved.

Thanks and regards,

..matthew

PS. Using Vis C++6, Client is Win 2000 Pro, Server is Win 2000 Advanced
Server).



Sun, 26 Oct 2003 22:35:57 GMT  
 NULL INT field gives strange value in CRecordset class.
See this article: "PRB: C Datatype's Pseudo Null Values Are Not Inserted into
SQL Database Correctly"
ID: Q231875


Sun, 26 Oct 2003 22:43:54 GMT  
 NULL INT field gives strange value in CRecordset class.
Thanks Scot. IsFieldNull() is my baby.

..matthew

Quote:

> See this article: "PRB: C Datatype's Pseudo Null Values Are Not Inserted into
> SQL Database Correctly"
> ID: Q231875



Mon, 27 Oct 2003 00:23:34 GMT  
 NULL INT field gives strange value in CRecordset class.
See Knowledge Base article Q231875.

'1246576928' is '4a4d4120' in hex, this the pseudo-NULL value for long.

Ian.


Quote:
> Hi,

> My software uses a MFC CRecordset derived class.

> Occasionally when I am doing a query 2 integer fields have strange
> values. It seems that in the Database Table they are NULL. I'm accessing
> them as a long in my MFC code, they are integers in the actual table.

> The values are both '1246576928' (they should be 5 digits) - I had
> assumed that NULL values in the database table would translate as 0 in
> the member of the CRecordset class.

> How do I tell in my MFC class when I'm getting a NULL value? It would be
> hard to replace all NULL values in the table with 0 as there are many
> tables involved.

> Thanks and regards,

> ..matthew

> PS. Using Vis C++6, Client is Win 2000 Pro, Server is Win 2000 Advanced
> Server).



Mon, 27 Oct 2003 01:01:12 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. NULL INT field gives strange value in CRecordset class.

2. Check for NULL-Values in DoFielExchange CRecordset derieved class

3. Setting not Null field to ""(empty string) does not work with CRecordset

4. CRecordset & NULL fields

5. Setting not Null field to ""(empty string) does not work with CRecordset

6. Detecting/setting field NULL values using OLE DB ?

7. Setting a field value to NULL

8. Detecting/setting field NULL values using OLE DB ?

9. ODBC: How to store a NULL value into an integer field

10. Null in an int value

11. Access memo fields from AppWizard CRecordset based classes

12. Enumerated field access thru CRecordset-derived class

 

 
Powered by phpBB® Forum Software