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. Database & SysAdmin
  3. Database
  4. Error in sql command when using ado in VC++ and unicode

Error in sql command when using ado in VC++ and unicode

Scheduled Pinned Locked Moved Database
databasehelpc++sql-serversysadmin
4 Posts 3 Posters 1 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.
  • M Offline
    M Offline
    mazen keeikati
    wrote on last edited by
    #1

    my database on sql server 2005, and i was convert my project VC++ to unicode, the problem is : when i try to read a field value string from recordset the data is "??????" the code is:

    _variant_t vFieldName (strFieldName);
    _variant_t ret = m_rs->GetFields ()->GetItem (vFieldName)->GetValue();
    CString str = (wchar_t *)(_bstr_t)vVal;

    :mad: when the language string is english ok but when it in other language the string is "???????"

    M 1 Reply Last reply
    0
    • M mazen keeikati

      my database on sql server 2005, and i was convert my project VC++ to unicode, the problem is : when i try to read a field value string from recordset the data is "??????" the code is:

      _variant_t vFieldName (strFieldName);
      _variant_t ret = m_rs->GetFields ()->GetItem (vFieldName)->GetValue();
      CString str = (wchar_t *)(_bstr_t)vVal;

      :mad: when the language string is english ok but when it in other language the string is "???????"

      M Offline
      M Offline
      Mycroft Holmes
      wrote on last edited by
      #2

      This implies that your fields in the database are varchar and not nvarchar.

      Never underestimate the power of human stupidity RAH

      M 1 Reply Last reply
      0
      • M Mycroft Holmes

        This implies that your fields in the database are varchar and not nvarchar.

        Never underestimate the power of human stupidity RAH

        M Offline
        M Offline
        mazen keeikati
        wrote on last edited by
        #3

        thanks when i convert the field type from varchar to nvarchar the problem fixed.

        L 1 Reply Last reply
        0
        • M mazen keeikati

          thanks when i convert the field type from varchar to nvarchar the problem fixed.

          L Offline
          L Offline
          Luc Pattyn
          wrote on last edited by
          #4

          Keep in mind that it also doubles the size (in bytes) of the field! :)

          Luc Pattyn [My Articles] Nil Volentibus Arduum

          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