Goran Bibic

Goran Bibic

  • 453
  • 2.9k
  • 180.6k

connection string oracle schema table c#

Oct 25 2023 5:58 AM

Database name is TEST, user name test, pass test1234

I create fake acocunt, conection to db work

Data are located ond next loaction:

When connected do db OTHER USERS/MASTER/Table1

How to read that data to datarid?

I try this cod and have error: NETWORK LIBRARY: Name-Value syntax error

Error number: ORA-00303

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();                            
}

 


Answers (1)