Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'Practica 13 - DataGridView con Ordenacion
- Imports System.Data.OleDb
- Public Class Form1
- 'Declaramos los objetos BD que vamos a usar.
- 'Estamos usando una BD de Access 2003 (.MDB) llamada PELICULAS.MDB
- 'Que contiene varias tablas, pero para este caso, solo usamos una.
- Dim cnn As New OleDbConnection("Provider=Microsoft.Jet.OleDb.4.0;Data Source=peliculas.mdb;User Id=admin; Password=;")
- Dim da As New OleDbDataAdapter("Select * From peliculas", cnn)
- Dim ds As New DataSet
- Dim dv As DataView
- Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
- ' Aqui va la ordenacion, segun el valor que tecleamos en la caja de texto izquierda
- dv.Sort = Trim(TextBox1.Text)
- End Sub
- Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
- 'Llenar el datagridview con tabla peliculas
- da.Fill(ds)
- dv = ds.Tables(0).DefaultView
- DataGridView1.DataSource = dv.Table
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement