C # It is common to access Oracle, but there are various exceptions in the actual work. I would like to analyze and summarize them as follows for convenience in the future:
The character set of a database is commonly used in two ways:
US Code simplified chinese_china.us7ascii
China Code simplified chinese_china.zhs16gbk
Connection method:
1. oledb connection
{Provider = msdaora.1; user id = Martin; Password = 1; Data Source = orcl; Unicode = true; Integrated Security = yes; persist Security info = false}
{Provider = oraoledb. Oracle; user id = Martin; Password = 1; Data Source = orcl; Unicode = true; persist Security info = false}
Oledb connects to Oracle in two ways: different drivers written by Microsoft and Oracle.
Provider = msdaora.1 is a driver written by Microsoft
Provider = oraoledb. Oracle is the built-in driver of oracle.
Summary:
Use the oledb connection driven by msdaora.1. No garbled characters are found whether the database character set is us7ascii or zhs16gbk, it may be caused by the inconsistent character set between the local Oracle Database and the server Oracle database. You need to modify the variable nls_lang in the registry. However, when msdaora.1 is used on x64 OracleProgram. That is to say, msdaora.1 does not support 64-bit oracle.
Use the oraoledb. Oracle-driven oledb connection, which supports China Code zhs16gbk very well. If the Oracle character set is US-encoded us7ascii, the data is read without garbled characters, and the Chinese parameters passed as the where condition are garbled characters.
Oraoledb. Oracle is not affected by Oracle's 32-bit or 64-bit.
2. Other Connection Methods
Refer to blog:
Http://blog.csdn.net/jack_33/article/details/7620100;