Oracle Data Adapter recovering files don't bring special characters like ñ

programinca 21 Reputation points
2021-12-14T17:50:25.197+00:00

Hi, I'm having an issue when I'm trying to recover data from Oracle into a DataTable.
Some files in Oracle, contains characters like ñ but in the DataTable results, that character turns in this: "?"

I'm using this code:

static string cnnString = @"Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=XXXXX)(PORT=XXXXX))(CONNECT_DATA=(SID=XXXXX)));User Id=XXXXX;Password=XXXXX;";



            DataTable dtResult = new DataTable();

            using (OracleConnection cnn = new OracleConnection(cnnString))
            {
                OracleCommand cmd = new OracleCommand(@" SELECT * FROM TABLA ", cnn);

                cmd.CommandType = CommandType.Text;

                OracleDataAdapter da = new OracleDataAdapter(cmd);

                cnn.Open();

                da.Fill(dtResult);

                cnn.Close();
            }

dtResults bring me the data without ñ characters. Someone could help me to fix it?

Thanks in advance!

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,277 questions
{count} votes

1 answer

Sort by: Most helpful
  1. P a u l 10,406 Reputation points
    2021-12-15T18:32:10.183+00:00

    If you set Unicode to true on the connection does that correct it?

    i.e.

    cnn.Unicode = true;

    As the first line inside your using statement.

    0 comments No comments