How to use a Oracle database in ASP.NET without Entity Framework?
I think this is the simple way to do this:
using System.Data.OracleClient; public string GetConnectionString() { String connString = "SERVER=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=YourHostName)(PORT=YourPort))(CONNECT_DATA=(SERVICE_NAME=YourServiceName)));uid=YourUserId;pwd=YourPassword;"; return connString; } public void ConnectingToOracle() { string connectionString = GetConnectionString(); using (OracleConnection connection = new OracleConnection()) { connection.ConnectionString = connectionString; connection.Open(); OracleCommand command = connection.CreateCommand(); string sql = "select * from MyDatabase where name like '%John Paul%'"; command.CommandText = sql; OracleDataReader reader = command.ExecuteReader(); while (reader.Read()) { string myField = (string)reader["address"]; //Get the address of John Paul } } }