示例#1
0
        private void frmVerCancion_Load(object sender, EventArgs e)
        {
            DataTable dt = new DataTable();

            Models.Cancion  cancion  = new Models.Cancion();
            Models.Conexion conexion = new Models.Conexion();
            string          sql      = "select * FROM Music.Cancion";
            SqlCommand      cmd      = new SqlCommand(sql, conexion.conexion);
            SqlDataAdapter  da       = new SqlDataAdapter(cmd);

            da.Fill(dt);
            dgvCanciones.DataSource = dt;
        }
        private void CargarCBAlbum()
        {
            DataTable dt = new DataTable();

            Models.Conexion conexion = new Models.Conexion();
            string          sql      = "select * FROM Music.Album";
            SqlCommand      cmd      = new SqlCommand(sql, conexion.conexion);
            SqlDataAdapter  da       = new SqlDataAdapter(cmd);

            da.Fill(dt);
            cbAlbum.DisplayMember = "nombre";
            cbAlbum.ValueMember   = "nombre";
            cbAlbum.DataSource    = dt;
        }