ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel OLEDB reading Chinese characters problem (https://www.excelbanter.com/excel-programming/372682-excel-oledb-reading-chinese-characters-problem.html)

[email protected]

Excel OLEDB reading Chinese characters problem
 
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
}



All times are GMT +1. The time now is 07:14 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com