Please help me figure out how to make the right connection to the Oracle database in MVC 4 in VS 2015. I’m just learning MVC, I wrote the following in the console application: I connected Oracle.DataAccess.dll then:

try { string oradb = "Data Source = 192.168.0.2/orcl; User id = user; password = 1234"; OracleConnection connect = new OracleConnection(oradb); connect.Open(); OracleCommand cmd = new OracleCommand(); cmd.Connection = connect; cmd.CommandText = "Select * from users"; OracleDataReader dateReader = cmd.ExecuteReader(); dateReader.Read(); Console.WriteLine("Test{0}", dateReader.GetChar(1)); } catch (Exception ex) { Console.WriteLine("Ошибка{0}", ex); } 

Help, if possible with an example, thank you very much

  • do the same (if this method works). What is the problem? - DreamChild
  • @DreamChild Yes, no big problems, I thought something had changed since then. - Ethernets
  • and it looks somehow different - Ethernets
  • @DreamChild I would like to consult on the correctness of creating a connection, how best to do this? to create a separate class, and then the controller to inherit from this class? How to make database queries? thanks - Ethernets

0