コード例 #1
0
        public IntermediarioConexion(string ip, string puerto, string timeOut,string baseDeDatos)
        {
            //string hostname = "celulosabaradero2.dyndns.org";
            string ipe;
            try
            {
                IPHostEntry host;
                host = Dns.GetHostEntry(ip);
                ipe = host.AddressList[0].ToString();
            }
            catch (Exception e)
            {
                ipe = ip;
            }

            //Conexion = new ConectorDB(host.AddressList[0].ToString(), "lectorcodigo", "root", "",puerto);
            //Conexion = new ConectorDB("192.168.1.118", "lectorcodigo", "root", "",puerto);
            //Conexion = new ConectorDB("localhost", "lectorcodigo", "root", "",puerto);
            //Conexion = new ConectorDB("181.15.203.42", "lectorcodigo", "root", "",puerto); //ipserverCaseros
            //Conexion = new ConectorDB("192.168.1.190", "lectorcodigo", "root", "",puerto); //ipserverCaseros
            //Conexion = new ConectorDB("192.168.1.155", "lectorcodigo", "root", "",puerto); //ipLanBaradero
            //Conexion = new ConectorDB("181.14.173.208", "lectorcodigo", "root", "",puerto);//ipserverBaradero
            //Conexion = new ConectorDB(ip, "lectorcodigo", "root", "", puerto);

            Conexion = new ConectorDB(ipe, baseDeDatos, "root", "", puerto, timeOut);

            DatosDeTabla = new DataTable();
        }
コード例 #2
0
        public void ConexionDBFallidaPorPuerto()
        {
            ConectorDB conector;
            conector = new ConectorDB("localhost", "testDB", "root", "", "123", "1");

            Assert.IsFalse(conector.OpenConnection());
        }
コード例 #3
0
        public void ConexionDBFallidaPorBaseDeDatos()
        {
            ConectorDB conector;
            conector = new ConectorDB("localhostt", "testDbbB", "root", "", "", "1");

            Assert.IsFalse(conector.OpenConnection());
        }
コード例 #4
0
        public void ConexionDBFallidaPorContrasenia()
        {
            ConectorDB conector;
            conector = new ConectorDB("localhostt", "testDB", "root", "3232", "", "1");

            Assert.IsFalse(conector.OpenConnection());
        }
コード例 #5
0
        public void ConexionDBExitosa()
        {
            ConectorDB conector;

            conector = new ConectorDB("127.0.0.1", "testDB", "root", "", "3306","1");

            Assert.IsTrue(conector.OpenConnection());
            conector.CloseConnection();
        }