M
Morten
Hi there!
I'm building a VB.NET application that connects to a MS SQL 2000 Server
through ADO.NET.
NOTE: My application can correctly read and show Chinese characters
retrieved from the database (they are stored in a 'nchar' column).
However, when I try to store some Chinese characters through an INSERT or
UPDATE statement, the database only receives a questionmark ('?') for each
Chinese character.
I have tried through both System.Data.OleDb.* and System.Data.SqlClient.*,
but they both yield the same unsatisfying result.
My code is something like (here with System.Data.OleDb):
------------------------------------------
Dim cn As New System.Data.OleDb.OleDbConnection("Data Source=XXXXX;
Provider=SQLOLEDB; Initial Catalog=XXXXX; User Id=XXXXX; Password=XXXXX;")
Dim cmd As New System.Data.OleDb.OleDbCommand("UPDATE myTable SET
chineseText=? WHERE id=1;", cn)
Dim par As New System.Data.OleDb.OleDbParameter("name",
System.Data.OleDb.OleDbType.Char)
par.Value = myChineseTextBox.Text
cmd.Parameters.Add(par)
cmd.ExecuteNonQuery()
cn.Close()
------------------------------------------
Oh yeah: I'm using the .NET 1.0 framework.
Please help me, since this is driving me nuts. Am I missing something in the
connection string, or should I do something special to my objects, so they
don't drop the Chinese characters?
Cheers,
~Morten ;-)
I'm building a VB.NET application that connects to a MS SQL 2000 Server
through ADO.NET.
NOTE: My application can correctly read and show Chinese characters
retrieved from the database (they are stored in a 'nchar' column).
However, when I try to store some Chinese characters through an INSERT or
UPDATE statement, the database only receives a questionmark ('?') for each
Chinese character.
I have tried through both System.Data.OleDb.* and System.Data.SqlClient.*,
but they both yield the same unsatisfying result.
My code is something like (here with System.Data.OleDb):
------------------------------------------
Dim cn As New System.Data.OleDb.OleDbConnection("Data Source=XXXXX;
Provider=SQLOLEDB; Initial Catalog=XXXXX; User Id=XXXXX; Password=XXXXX;")
Dim cmd As New System.Data.OleDb.OleDbCommand("UPDATE myTable SET
chineseText=? WHERE id=1;", cn)
Dim par As New System.Data.OleDb.OleDbParameter("name",
System.Data.OleDb.OleDbType.Char)
par.Value = myChineseTextBox.Text
cmd.Parameters.Add(par)
cmd.ExecuteNonQuery()
cn.Close()
------------------------------------------
Oh yeah: I'm using the .NET 1.0 framework.
Please help me, since this is driving me nuts. Am I missing something in the
connection string, or should I do something special to my objects, so they
don't drop the Chinese characters?
Cheers,
~Morten ;-)