Hi Friends , being working for ages to get it resolve.
i have a Requirement where i need to import CSV (Tab delimited) file to SQL Server , all the code is working correctly and the data is getting imported correctly except the chinese characters .
The programming logic is to create the scheme.ini file as below
FileStream fsOutput = new FileStream(dirtrectoryinfo + "\\schema.ini", FileMode.Create, FileAccess.Write);
StreamWriter srOutput = new StreamWriter(fsOutput, System.Text.Encoding.GetEncoding(936));
string s1, s2, s3, s4, s5;
s1 = "[" + fname + "]";
s2 = "ColNameHeader=True";
s3 = "Format=Delimited(|)";
s4 = "MaxScanRows=25";
s5 = "CharacterSet=ANSI";
srOutput.WriteLine(s1.ToString() + "\r\n" + s2.ToString() + "\r\n" + s3.ToString() + "\r\n" + s4.ToString() + "\r\n" + s5.ToString());
srOutput.Close();
fsOutput.Close();
i used Unicode , but it hangs when the code reach at executeReader , if i use ANSI then the file get process but chinese character are not displayed correctly.
string sql_select;
OdbcConnection conn;
conn = new OdbcConnection(strConnString.Trim());
conn.Open();
OdbcCommand commandRowCount = new OdbcCommand("SELECT COUNT(*) FROM [" + fileName.Trim() + "]", conn);
sql_select = "select * from [" + fileName.Trim() + "]";
OdbcCommand commandSourceData = new OdbcCommand(sql_select, conn);
commandSourceData.CommandTimeout = 0;
OdbcDataReader dataReader = commandSourceData.ExecuteReader();
DataTable dt;
whats is the correct way to create the schema.ini file and how can i import the file with correct chinese chracter