简体   繁体   中英

Using DAO to manipulate NULL values in record sets in C++

I'm trying to access a record set containing null values using the methods described in:

http://msdn.microsoft.com/en-us/library/ff965871.aspx

I'm using DAO in particular and it works, except when you return a result from an access query like:

SELECT MAX(ID) FROM [TABLE] WHERE KEY = SOMETHING NOT THERE

This returns a record set with 1 record that contains a null value, and trying to access it using record set pointer functions:

rsp->getitem(0)

works but

rsp->getitem(0)->getvalue()

throws a strange exception that I can't find online. I'm wondering if anyone knows how to handle NULL values in C++, functions that work in VBA like "IS NULL" don't seem to be available.

getvalue should return variant type and you may check vt property of returned value. Most likely if nothing returned it will be VT_NULL.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM