A
A
Albert2020-09-13 21:38:28
Oracle
Albert, 2020-09-13 21:38:28

Empty response Oracle c# WPF output query results to table?

Good hour!

See this question, I'm making a connection to a database like Oracle. I send a request, I get a response, but for some reason the response does not contain rows, but it contains the names of the columns, I can’t figure out where to dig ...

Connection string:

<connectionStrings>
    <add name="myConnectionString"
         connectionString="DATA SOURCE=localhost:1521/orcl;USER ID = SYS;PASSWORD = 111111111;DBA PRIVILEGE = SYSDBA;"
         providerName="Oracle.ManagedDataAccess.Client"/>
  </connectionStrings>


The body of the request execution and insertion into the table:
private void updateMyDataGrid() {
            OracleCommand cmd = con.CreateCommand();

            cmd.CommandText = "select * from firm";

            cmd.CommandType = CommandType.Text;
            OracleDataReader dr = cmd.ExecuteReader();
            DataTable dt = new DataTable();
            dt.Load(dr);

            //помещаю полученный результат в DataGrid
            myDataGrid.ItemsSource = dt.DefaultView;
            dr.Close();
        }


The result of the query:
5f5e6625bb475538217571.png

As you can see, the table header comes and that's it. Where am I wrong or what am I doing wrong?

Well, actually the table itself to which the request goes:
5f5e6703af3c4444212244.png

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Roman, 2020-09-14
@yarosroman

Check, after loading, the HasErrors property and see the errors via GetErrors()

A
Albert, 2020-09-14
@6ETuK

There was a poop about magic, I don’t know whether oracle got used to my computer or, but it just took it and it worked as it should .... so I started to see the errors on your advice ... Thanks for the tips anyway)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question