日期:2014-05-17  浏览次数:20971 次

连接ORACLE查询数据库中文问题
以下是执行查询的代码,如果传输过去的查询条件是英文字母字符串就正常,如果是中文就查询不出结果,在查询分析器内用中文查询正常;请大侠帮忙分析下原因,是C#内要设置中文兼容还是哪里编码不对;

public DataTable ExecuteQuery(string sqlString)
        {
            using (System.Data.IDbConnection  iConn = this.GetConnection())    
            {    
                //System.Data.IDbCommand iCmd  =  GetCommand(sqlString,iConn);
                DataSet ds = new DataSet();
                try
                {
                    System.Data.IDataAdapter iAdapter = this.GetAdapater(sqlString,iConn);            
                    iAdapter.Fill(ds);
                }
                catch(System.Exception e)
                {                
                    throw new Exception(e.Message);
                }    
                finally
                {
                    if(iConn.State != ConnectionState.Closed)
                    {
                        iConn.Close();
                    }
                }
                return ds.Tables[0];
            }
        }