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. Issue using SQL server

Issue using SQL server

Scheduled Pinned Locked Moved C / C++ / MFC
databasehelpc++sharepointsql-server
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.
  • S Offline
    S Offline
    ShilpiP
    wrote on last edited by
    #1

    Hi, I am creating one sample application that uses SQL Server and create one table having ID and Title (Unicode data).My problem is that i am using unicode data and when i open the table, "Question mark " is displayed in Title instead of unicode data. My workspace is unicode compiled and i am using nvarchar for lingual data as a variable. Here is my code

    CDatabase db;
    CString strLingual = L"";
    // strLingual contains unicode data.
    m_edt_lingual.GetWindowTextW(strLingual);
    CString strQuery;
    try
    {
    // Test with Access database
    if (db.Open(NULL, FALSE, FALSE, _T("Driver={SQL Native Client};Server=SHILPI_PHADNIS\\SQLEXPRESS;Database=TransTool;Uid=sp;Pwd=np;")))
    {
    // Create a test table
    db.ExecuteSQL(_T("CREATE TABLE WDCheckLingual (ID INT, Title NVARCHAR(50))"));

    		// Add some test data
    		for (int i = 0; i < 10; i++)
    		{
    			strQuery.Format(\_T("INSERT INTO WDCheckLingual (ID, Title) VALUES (%d, '%s')"),
    				i + 1, strLingual);
    			db.ExecuteSQL(strQuery);
    		}
    
    	}
    }
    catch (CException \*e)
    {
    	e->ReportError();
    	e->Delete();
    }
    

    Thanks in advance.... :)

    Yes U Can ...If U Can ,Dream it , U can do it ...ICAN

    R 1 Reply Last reply
    0
    • S ShilpiP

      Hi, I am creating one sample application that uses SQL Server and create one table having ID and Title (Unicode data).My problem is that i am using unicode data and when i open the table, "Question mark " is displayed in Title instead of unicode data. My workspace is unicode compiled and i am using nvarchar for lingual data as a variable. Here is my code

      CDatabase db;
      CString strLingual = L"";
      // strLingual contains unicode data.
      m_edt_lingual.GetWindowTextW(strLingual);
      CString strQuery;
      try
      {
      // Test with Access database
      if (db.Open(NULL, FALSE, FALSE, _T("Driver={SQL Native Client};Server=SHILPI_PHADNIS\\SQLEXPRESS;Database=TransTool;Uid=sp;Pwd=np;")))
      {
      // Create a test table
      db.ExecuteSQL(_T("CREATE TABLE WDCheckLingual (ID INT, Title NVARCHAR(50))"));

      		// Add some test data
      		for (int i = 0; i < 10; i++)
      		{
      			strQuery.Format(\_T("INSERT INTO WDCheckLingual (ID, Title) VALUES (%d, '%s')"),
      				i + 1, strLingual);
      			db.ExecuteSQL(strQuery);
      		}
      
      	}
      }
      catch (CException \*e)
      {
      	e->ReportError();
      	e->Delete();
      }
      

      Thanks in advance.... :)

      Yes U Can ...If U Can ,Dream it , U can do it ...ICAN

      R Offline
      R Offline
      Rajesh R Subramanian
      wrote on last edited by
      #2

      Hello, This is with regards to the query you asked me here[^]. Somehow, I am unable to add a reply there. So, I sent you an email. If you have not received, feel free to reply here and I shall assist you.

      It is a crappy thing, but it's life -^ Carlo Pallini

      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