When trying to display a list of values in ComboBox from a query to an Oracle database, a request error is issued:
-2147467259 - Oracle.ManagedDataAccess.Client.OracleErrorCollection
Oracle.ManagedDataAccess version 4.122.18.3
The code block itself:
public static class Setting { public static string ora_connect = "User Id=***;Password=***;Data Source=***"; public static string ora_street = "SELECT STREET, trim(NAME) NAME from address;"; } private void comboBox1_DropDown(object sender, EventArgs e) { OracleConnection connection = new OracleConnection(Setting.ora_connect); try { connection.Open(); OracleCommand command = new OracleCommand(Setting.ora_street, connection); OracleDataAdapter adapter = new OracleDataAdapter(command); OracleDataReader reader = command.ExecuteReader(); DataTable data = new DataTable(); data.Columns.Add("Name", typeof(string)); data.Columns.Add("Streets", typeof(Int32)); data.Load(reader); comboBox1.DisplayMember = "Name"; comboBox1.ValueMember = "Streets"; comboBox1.DataSource = data.DefaultView; connection.Close(); connection.Dispose(); } catch (OracleException ex) { MessageBox.Show("Ошибка запроса!"); MessageBox.Show(ex.ErrorCode + " - " + ex.Errors); System.Windows.Forms.Application.Exit(); } }