An ADO problem
-
I am doing something like:
std::string id=(char *)(_bstr_t)m_pRecordSet->GetCollect(L"id");
i.e I am collecting the "id" field value from record set object and assigning it to string. This works fine for me. But the problem is that the value of "id" field can be NULL. And whenever such situation appears, my program raises an exception. How can i prevent this error and copy NULL to string successfully when this situation happens.
-
I am doing something like:
std::string id=(char *)(_bstr_t)m_pRecordSet->GetCollect(L"id");
i.e I am collecting the "id" field value from record set object and assigning it to string. This works fine for me. But the problem is that the value of "id" field can be NULL. And whenever such situation appears, my program raises an exception. How can i prevent this error and copy NULL to string successfully when this situation happens.
std::string id=(char *)(_bstr_t)m_pRecordSet->GetCollect(L"id"); Hi I think that GetCollect returns a variant, and in case of NULL values, this variant has a VT type of VT_NULL,you could check for it.