Click here to Skip to main content
15,887,135 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Database name is TEST, user name test, pass test1234

I create a fake account, conection to db work.
Data are located on next loaction:
When conect to db OTHER USERS/MASTER/Table1
How to read that data to datagrid?
I try this code and have error:
NETWORK LIBRARY: Name-Value syntax error
Error number: ORA-00303


What I have tried:

C#
private void TABLE_fill()
       {
           String connectionString = "Data Source=("
                                + "   TEST = "
                                + " (DESCRIPTION = "
                                + "   (ADDRESS = (PROTOCOL = TCP)(HOST = 
                                test.localdomain.intra)(PORT = 1521)) "
                                + " (CONNECT_DATA = "
                                + "    (SERVICE_NAME = TEST) "
                                + "    (INSTANCE_NAME = TEST) "
                                + " ) "
                                + " ) "
                                + " User Id=test; password=test1234; ";

           OracleConnection con = new OracleConnection();
           con.ConnectionString = connectionString;
           con.Open();

           OracleCommand cmd= new OracleCommand();
           cmd.CommandText = "select * from Table1";
           cmd.Connection= con;
           cmd.CommandType = CommandType.Text;
           //cmd.ExecuteNonQuery();

           OracleDataReader dr = cmd.ExecuteReader();
           dr.Read();
           System.Data.DataTable dataTable = new System.Data.DataTable();
           dataTable.Load(dr);
           ListDataGridView.DataSource = dataTable;

           ListDataGridView.Update();
           ListDataGridView.Refresh();
}
Posted
Updated 6-Nov-23 4:09am
v2

1 solution

I'm not an expert on Oracle connection strings (though this may help: Oracle connection strings - ConnectionStrings.com[^] ) but ... I can spot an unmatched bracket when I see one:
String connectionString = "Data Source=("
                     + "..."
                     + " (..."
                     + "   (... (...)(...)(...)) "
                     + " (..."
                     + "    (...) "
                     + "    (...) "
                     + " ) "
                     + " ) "
                     + " ... ";
First "(" is unmatched.
 
Share this answer
 
Comments
Maciej Los 6-Nov-23 13:13pm    
5ed!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900