Foro de elhacker.net

Programación => .NET (C#, VB.NET, ASP) => Mensaje iniciado por: rooten en 8 Junio 2012, 09:37 am



Título: AYUDA: Encapsular el codigo en un .COM (DLL) y luego llamarlo en la aplicacion.
Publicado por: rooten en 8 Junio 2012, 09:37 am
Bueno , la cosa esque necesito tener el siguiente codigo en un .dll y luego llamarlo desde el programa en sí, el codigo es el siguiente , espero me puedan ayudar , gracias.!  :huh:
[lenguaje: C# ASP.NET , conexión a MYSQL ]

        int id;
        id = Convert.ToInt32(TextBox1.Text);
        string ConexionBa = "Server=localhost;Database=biblioteca; Uid=root;Pwd=;";
        string strSQLL = "select * from libro where id_Libro = '" + id + "';";

        MySqlConnection conexx = new MySqlConnection(ConexionBa);

        MySqlCommand comande = new MySqlCommand(strSQLL, conexx);

        conexx.Open();

        MySqlDataReader readere = comande.ExecuteReader();

        if (readere.Read())
        {

            TextBox2.Text = readere.GetString(0);
            TextBox3.Text = readere.GetString(1);
            TextBox4.Text = readere.GetString(2);
            TextBox5.Text = readere.GetString(3);
            TextBox6.Text = readere.GetString(4);

            readere.Close();
            conexx.Close();
        }
        else
        { Label8.Text = "El libro no esta registrado"; }