Excel OLEDB reading Chinese characters unicode problem

C

Chris Yan

Hi All

I have an excel sheet with Chinese characters in them.

I'm using the OLEBE 4.0 Jet Driver in C# Microsoft Visual Studio 2005
to read from the Excel sheet and then enter into mySQL database.

The problem isn't with mysql but with C# reading the chinese characters
from Excel.

Right now, All I get with chinese characters is question marks
"?????????"

MY OLEDB driver should be able to support multi-language but it doesn't
seem to be working.

Can anyone help?

Code:
String sConnectionString =
"Provider=Microsoft.Jet.OLEDB.4.0;" +
@"Data Source=C:\language.xls;" +
"Extended Properties=Excel 8.0;";

OleDbConnection objConn = new
OleDbConnection(sConnectionString);

objConn.Open();

OleDbCommand objCmdSelect = new OleDbCommand("SELECT * FROM
[Sheet1$]", objConn);
OleDbDataReader reader = objCmdSelect.ExecuteReader();


//---
String myConnectionString =
"server=192.168.168.6;uid=xxxx;pwd=xxxxx;database=xxxxxxx_db;";
MySqlConnection myConnection = new
MySqlConnection(myConnectionString);

while (reader.Read())
{

*this is where I generate my sql query
}
 
J

Jon Skeet [C# MVP]

Chris Yan said:
I have an excel sheet with Chinese characters in them.

I'm using the OLEBE 4.0 Jet Driver in C# Microsoft Visual Studio 2005
to read from the Excel sheet and then enter into mySQL database.

The problem isn't with mysql but with C# reading the chinese characters
from Excel.

Right now, All I get with chinese characters is question marks
"?????????"

See http://www.pobox.com/~skeet/csharp/debuggingunicode.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top