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. ADO _RecordsetPtr: how to PutCollect() a NULL value?

ADO _RecordsetPtr: how to PutCollect() a NULL value?

Scheduled Pinned Locked Moved C / C++ / MFC
databasetutorialquestionannouncement
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.
  • H Offline
    H Offline
    hanlei0000000009
    wrote on last edited by
    #1

    These code put a string into name which is a column in database table _RecordsetPtr rec; rec.CreateInstance(_uuidof(Recordset)); CString cstrSQL; cstrSQL.Format("SELECT * FROM ... where ..."); rec->Open(_bstr_t(cstrSQL), (IDispatch*)g_pConnections, adOpenDynamic, adLockOptimistic, adCmdText); rec->PutCollect("name",_variant_t("my name")); rec->Update(); But,how to PutCollect a NULL value into this column?

    S 1 Reply Last reply
    0
    • H hanlei0000000009

      These code put a string into name which is a column in database table _RecordsetPtr rec; rec.CreateInstance(_uuidof(Recordset)); CString cstrSQL; cstrSQL.Format("SELECT * FROM ... where ..."); rec->Open(_bstr_t(cstrSQL), (IDispatch*)g_pConnections, adOpenDynamic, adLockOptimistic, adCmdText); rec->PutCollect("name",_variant_t("my name")); rec->Update(); But,how to PutCollect a NULL value into this column?

      S Offline
      S Offline
      swjtu_ran
      wrote on last edited by
      #2

      _RecordsetPtr rec; rec.CreateInstance(_uuidof(Recordset)); CString cstrSQL; cstrSQL.Format("SELECT * FROM ... where ..."); rec->Open(_bstr_t(cstrSQL), (IDispatch*)g_pConnections, adOpenDynamic, adLockOptimistic, adCmdText); if(sName =="") //NULL { rec->PutCollect("name", VT_NULL); } else { rec->PutCollect("name",_variant_t("my name")); } rec->Update();

      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