AMCoded
AMCoded

Reputation: 1444

writing unicode characters to Database using ODBC in MFC Application

I have connected to a database using ODBC in an unicode MFC Application and I am filling the database with some unicode data with the CDatabase::ExecuteSQL(CStringW ...) like below:

CStringW sSql;
sSql.Format(L"INSERT INTO Reports ( %s, '%s')", sField1, sValue1);
m_db.ExecuteSQL(sSql);

but what i actually write into database is some ? characters instead of unicode ones. Is there any solution to this. Regards

Upvotes: 1

Views: 538

Answers (1)

Eddie Paz
Eddie Paz

Reputation: 2241

Make sure your database field is of type NVARCHAR(x).

Upvotes: 1

Related Questions