Essays.club - Ensayos gratis, notas de cursos, notas de libros, tareas, monografías y trabajos de investigación
Buscar

Ejemplo de Programacion Orientada a Objetos - Con conexiones a base de Datos

Enviado por   •  2 de Enero de 2018  •  5.744 Palabras (23 Páginas)  •  493 Visitas

Página 1 de 23

...

da.Fill(ds, "ANUNCIO");

if (ds.Tables["ANUNCIO"].Rows.Count != 0)

{

txtAnun.Text = ds.Tables["ANUNCIO"].Rows[0]["DESCRIPCION"].ToString();

// El campo productImage primero se almacena en un buffer

byte[] imageBuffer = (byte[])ds.Tables["ANUNCIO"].Rows[0]["IMAGEN"];

// Se crea un MemoryStream a partir de ese buffer

System.IO.MemoryStream ms = new System.IO.MemoryStream(imageBuffer);

// Se utiliza el MemoryStream para extraer la imagen

imagen.Image = Image.FromStream(ms);

}

else

{

MessageBox.Show("El anuncio no esta disponible o no existe");

}

}

catch (Exception ex)

{

MessageBox.Show(ex.Message);

}

}

private void pictureBox1_Click(object sender, EventArgs e)

{

}

public void txtSeccion_TextChanged(object sender, EventArgs e)

{

}

private void label1_Click(object sender, EventArgs e)

{

}

private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)

{

if (e.Node.Text == "Frutas y Verduras")

{

SECCION q = new SECCION();

q.dataGridView1.DataSource = bd.SelectDataTable("select NOMBRE,PRECIO,DISPONIBILIDAD from Producto where SECCION =’Frutas y Verduras’");

q.Show();

}

else if (e.Node.Text == "Carnes")

{

SECCION q = new SECCION();

q.Show();

q.dataGridView1.DataSource = bd.SelectDataTable("select NOMBRE,PRECIO,DISPONIBILIDAD from Producto where SECCION =’Carnes’");

}

else if (e.Node.Text == "Alimentos y Bebidas")

{

SECCION q = new SECCION();

q.Show();

q.dataGridView1.DataSource = bd.SelectDataTable("select NOMBRE,PRECIO,DISPONIBILIDAD from Producto where SECCION =’Alimentos y Bebidas’");

}

else if (e.Node.Text == "Ropa y Calzado")

{

SECCION q = new SECCION();

q.Show();

q.dataGridView1.DataSource = bd.SelectDataTable("select NOMBRE,PRECIO,DISPONIBILIDAD from Producto where SECCION =’Ropa y Calzado’");

}

else if (e.Node.Text == "Tlapaleria y Ferreteria")

{

SECCION q = new SECCION();

q.Show();

q.dataGridView1.DataSource = bd.SelectDataTable("select NOMBRE,PRECIO,DISPONIBILIDAD from Producto where SECCION =’Tlapaleria y Ferreteria’ ");

}

else if (e.Node.Text == "Salud y Belleza")

{

SECCION q = new SECCION();

q.Show();

q.dataGridView1.DataSource = bd.SelectDataTable("select NOMBRE,PRECIO,DISPONIBILIDAD from Producto where SECCION =’Salud y Belleza’");

}

else if (e.Node.Text == "Cuidado Animal")

{

SECCION q = new SECCION();

q.Show();

q.dataGridView1.DataSource = bd.SelectDataTable("select NOMBRE,PRECIO,DISPONIBILIDAD from Producto where SECCION =’Cuidado Animal’");

}

else if (e.Node.Text == "Deportes")

{

SECCION q = new SECCION();

q.Show();

q.dataGridView1.DataSource = bd.SelectDataTable("select NOMBRE,PRECIO,DISPONIBILIDAD from Producto where SECCION =’Deportes’");

}

else if (e.Node.Text == "Abarrotes y Cremeria")

{

...

Descargar como  txt (15.8 Kb)   pdf (58.8 Kb)   docx (18.5 Kb)  
Leer 22 páginas más »
Disponible sólo en Essays.club