Programa
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.OleDb;//incluir este espacio de nombre
using MySql.Data.MySqlClient;
using System.Drawing.Imaging;
using System.IO;
namespace letsPlay
{
class Ingles
{
private MySqlConnectionconexion;
private MySqlCommand comando;
private MySqlDataReader registro; //Contenedor de esquema conectado
private MySqlDataReader registroFolio;
private MySqlDataAdapter adaptador; // consulta desconectado
private DataSet datos;
public Ingles(){
conexion=new MySqlConnection();
comando= new MySqlCommand();adaptador=new MySqlDataAdapter();
datos=new DataSet();
conexion.ConnectionString = "Server=localhost;User=root;password=;database=sistemaingles";
}
public Boolean AbrirDB()//Fucniones regresa valor boleano
{
Boolean exito = false;
try
{
if (conexion.State == ConnectionState.Closed){
//si la coneccio esta cerrada si la bamos a poder abrir
conexion.Open();
exito = true;//Esto es lo k voy a regresar
}
}
catch (MySqlException e) {/* Program.mensaje = e.Message; exito = false;*/ }
return exito;
}
public void CerrarDB()
{if (conexion.State == ConnectionState.Open) conexion.Close();
try { }
catch (MySqlException e) { /*Program.mensaje = e.Message;*/ }
}
public DataSet cargarComboVideo()
{
string sqlConsulta = "select * from video";
try
{
comando.CommandText = sqlConsulta;comando.Connection = conexion;
adaptador.SelectCommand = comando;
adaptador.Fill(datos, "video");
}
catch (MySqlException e) { /*Program.mensaje = e.Message; */}
return datos;
}
public MySqlDataReader Buscar(string NombreVideo)
{
string sqlConsulta = "";
try
{if (AbrirDB())
{
sqlConsulta = "select * from video where NombreVideo= " +NombreVideo;
comando.CommandText = sqlConsulta;
comando.Connection = conexion;
registro = comando.ExecuteReader();
}
}
catch (MySqlException e)
{/*Program.mensaje = e.Message; registro = null;*/
}
return registro;
}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace letsPlay
{
public partial class Form1 : Form
{
frmVideos videos = newfrmVideos();
frmJuegos juegos=new frmJuegos();
frmActividades actividades = new frmActividades();
frmAprendisaje aprendisaje = new frmAprendisaje();
public Form1()
{
InitializeComponent();
}
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
try
{try
{
aprendisaje.Show();
}
catch (Exception exe)
{
aprendisaje = new frmAprendisaje();
aprendisaje.Show();
}
}
catch (Exception ex)
{
MessageBox.Show("Error: " + ex.Message);...
Regístrate para leer el documento completo.