Click here to Skip to main content
15,910,411 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
My Code block is

C#
public static DataSet GetCSVDataSet(string pFilePath)
        {
            DataSet ds = new DataSet();
            if (File.Exists(pFilePath))
            {
                string fileName = Path.GetFileName(pFilePath);
                string folder = pFilePath.Replace(fileName, "");

                string connString = string.Format(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=""{0}"";Extended Properties=""text;HDR=Yes;IMEX=1;FMT=Delimited;CHARSET=UNICODE\""", folder);

                OleDbConnection conn = new OleDbConnection(connString); 

                string qry = string.Format("Select [ProductId],[ProductName],[ProductNameKana],"+
                    "[ProductUrl],[Publisher],[PublisherId],[ProductPrice]," +
                    "[ProductSmallImageUrl],[ProductImageUrl],[ProductLargeImageUrl]," +
                    "[ProductThumbnailImageUrl],[ProductDescription]," +
                    "[ScheduleID] from {0}", fileName);  
                       
                try
                {
                    using (OleDbCommand cmd = new OleDbCommand(qry, conn))
                    {
                        cmd.Connection.Open();
                        using (OleDbDataAdapter odda = new OleDbDataAdapter(cmd))
                        {
                            odda.Fill(ds);
                        }
                        cmd.Connection.Close();
                    }
                }
                catch (Exception ex)
                {
                    ErrorLog.WriteLog("XLReader", "GetCSVDataSet", ex.Message, ex.StackTrace, pFilePath);
                }
                finally
                {
                    if (conn != null)
                    {
                        if (conn.State != ConnectionState.Closed)
                        {
                            conn.Close();
                        }
                        conn = null;
                    }
                    ds.Dispose();
                }


            }
            return ds;
        }

But while read Japanese character it is not working
Like エスエフミックス show as 手塚プロダクション


Please help
Posted
Updated 17-Jul-13 1:24am
v2
Comments
johannesnestler 17-Jul-13 8:51am    
where does it show the wrong characters? Most likely a code page problem of an non Unicode program or just the wrong font (not containing the japanese characters)... Or are you getting already wrong characters out of the query (Debugger)?
Mukesh Ghosh 18-Jul-13 1:28am    
I am getting this while load data from CSV to DAtaset
odda.Fill(ds); After Fill DS

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900