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