public string TestConnection() { DataFramework.ConexionDB con = new ConexionDB(); var conexion = con.ConectarDB(); con.OpenConnection(); if (conexion.State == System.Data.ConnectionState.Open) { string strConn = "ConnectionWorks"; con.CloseConnection(); return(strConn); } return("Connection Not Work"); }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); string ruta = Directory.GetParent(Directory.GetCurrentDirectory()).Parent.Parent.FullName; System.IO.StreamReader file = new StreamReader(Path.Combine(ruta, "config.txt")); string sqlcon = file.ReadLine(); string fechaF = file.ReadLine(); file.Close(); Sesion.conexion = ConexionDB.ConectarDB(sqlcon); Sesion.fechaActual = DateTime.Parse(fechaF); Application.Run(new Login.Login()); ConexionDB.DesconectarDB(Sesion.conexion); }