P
Pavils Jurjans
Hello, here's my testing code:
string dbConnStr = "*connstr*";
string sqlQuery;
OleDbCommand myCommand;
OleDbConnection myConnection = new OleDbConnection(dbConnStr);
myConnection.Open();
bool useParameters = false;
if (useParameters)
{
// With parameters
sqlQuery = "UPDATE App_Companies SET cmpNotes = ? WHERE cmpID = 0";
myCommand = new OleDbCommand(sqlQuery, myConnection);
myCommand.Parameters.Add("notes", OleDbType.VarWChar).Value = "*some
japanese characters*";
}
else
{
// With direct execute
sqlQuery = "UPDATE App_Companies SET cmpNotes = '*some japanese
characters*' WHERE cmpID = 0";
foreach (char c in sqlQuery) Console.Write ("{0:x4} ", (int)c); // DEBUG
myCommand = new OleDbCommand(sqlQuery, myConnection);
}
I save this CS file in UTF-8 encoding, and I know that csc.exe understands
it correctly, as I get correct results with using parameters. However, I
fail to update the ntext field of my database, using the unicode chars in
the sql statemnt itself. Is there some settings I can adjust to be able
*not* to use the parameters? Why is this difference in the first place?
Thanks,
-- Pavils
string dbConnStr = "*connstr*";
string sqlQuery;
OleDbCommand myCommand;
OleDbConnection myConnection = new OleDbConnection(dbConnStr);
myConnection.Open();
bool useParameters = false;
if (useParameters)
{
// With parameters
sqlQuery = "UPDATE App_Companies SET cmpNotes = ? WHERE cmpID = 0";
myCommand = new OleDbCommand(sqlQuery, myConnection);
myCommand.Parameters.Add("notes", OleDbType.VarWChar).Value = "*some
japanese characters*";
}
else
{
// With direct execute
sqlQuery = "UPDATE App_Companies SET cmpNotes = '*some japanese
characters*' WHERE cmpID = 0";
foreach (char c in sqlQuery) Console.Write ("{0:x4} ", (int)c); // DEBUG
myCommand = new OleDbCommand(sqlQuery, myConnection);
}
I save this CS file in UTF-8 encoding, and I know that csc.exe understands
it correctly, as I get correct results with using parameters. However, I
fail to update the ntext field of my database, using the unicode chars in
the sql statemnt itself. Is there some settings I can adjust to be able
*not* to use the parameters? Why is this difference in the first place?
Thanks,
-- Pavils