Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using Oracle.ManagedDataAccess.Client;
- namespace ConsoleApp1
- {
- class Program
- {
- private static readonly string connectinString = "Data Source=(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.99.100)(PORT = 1521)))(CONNECT_DATA = (SID = xe)));Persist Security Info=True;User ID=Teste;Password=123456;Pooling=True;Connection Timeout=60;";
- static void Main(string[] args)
- {
- Console.WriteLine("Hello Oracle!");
- using (var conn = new OracleConnection(connectinString))
- {
- using (var cmd = conn.CreateCommand())
- {
- conn.Open();
- cmd.CommandText = "select * from pessoa";
- var reader = cmd.ExecuteReader();
- while (reader.Read())
- {
- Console.WriteLine("===========================");
- Console.WriteLine($"Id:{reader["Id"]}");
- Console.WriteLine($"Nome: {reader["Nome"]}");
- }
- Console.WriteLine("===========================");
- reader.Dispose();
- }
- }
- Console.ReadKey();
- }
- }
- }
Add Comment
Please, Sign In to add comment