Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. An ADO problem

An ADO problem

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Anonymous
    wrote on last edited by
    #1

    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.

    P 1 Reply Last reply
    0
    • A Anonymous

      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.

      P Offline
      P Offline
      Prem Kumar
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups