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();
}
Prasad RaveendranPosted Oct 25, 2023, 8:43 PM
The error you're encountering, "NETWORK LIBRARY: Name-Value syntax error," is likely due to an issue with your connection string. The connection string you provided has a couple of issues. You should use the correct format for Oracle connection strings. Try the following corrected code:
In the corrected code:
SELECT * FROM OTHER_USERS.MASTER.Table1.Please replace
"OTHER_USERS"and"MASTER"with the actual schema and table names that you want to access in your database. Make sure your Oracle client and Oracle Data Provider for .NET are correctly installed and configured as well.