/*Se hace un metodo del tipo de la clase estatico * se Pregunta si la ins es nulo, si lo es * se crea una nueva instancia y se retorna * para acceder a la instancia solo usan PruebaConexion c = PruebaConexion.instancia(); * */ public static PruebaConexion instancia() { if (ins == null) { ins = new PruebaConexion(); } return(ins); }
//public static SqlCommand Ejecutar(string consultar, CommandType s) //{ // try // { // cmd = new SqlCommand(consultar, PruebaConexion.Conectar()); // cmd.ExecuteNonQuery(); // } // catch (SqlException ex) // { // //ScriptManager.RegisterStartupScript(this, GetType(), "Validar", "Hola();", true); // } // return cmd; //} public static SqlCommand Ejecutar(string comando) { try { cmd = new SqlCommand(comando, PruebaConexion.Conectar()); cmd.ExecuteNonQuery(); } catch (SqlException ex) { //ScriptManager.RegisterStartupScript(this, GetType(), "Validar", "Hola();", true); } return(cmd); }
internal static void Ejecutar(string v, PruebaConexion cmd) { throw new NotImplementedException(); }