us1979
us1979

Reputation: 51

How to check for DBNull in C++ - ADO recordset fields?

I was trying to retrieve data from SQL Server via ADO in C++ and how can I check the Null Values the recordset fields? thre is no IsNUll() function?

Upvotes: 5

Views: 2392

Answers (1)

Anya Shenanigans
Anya Shenanigans

Reputation: 94729

Testing for DBNull in a C++ ADO record set involves checking the fieldpointer->Value property, which is of type VARIANT. To test for null variant values, you check the vt field, which for null values is VT_NULL.

So to test for DBNull, check fieldpointer->Value.vt == VT_NULL

Upvotes: 6

Related Questions