You are on page 1of 3

CONSULTA SENCILLA BY WALTER STUARDO MONTERROSO Imports System.Data.

OleDb Public Class Form1 Dim conexion As New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0; Data Source=C:\Users\Server\Desktop\Consultas\CN.accdb") Dim adaptador As New OleDbDataAdapter("select * from BDConsulta", conexion) Dim ds As New DataSet Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Try Conexion.open() adaptador.fill(ds, "BDConsulta") Me.DataGridView1.DataSource = ds.Tables("BDConsulta") Me.DataGridView1.Refresh() Catch ex As Exception MessageBox.Show("No se encuentra el Servidor" + ex.Message, "AVISO") End Try Conexion.close() End Sub

Open() accs = "select * from BDConsulta" ORDEN_DB = New OleDb.Text ORDEN_DB.12.OleDbCommand(accs.OLEDB.CONSULTA STRING BY LV-SISTEMAS FT. ByVal e As System.Fill(D_Table) DataGridView1.CommandType = CommandType.DataSource = D_Table conexion. conexion) Dim ds As New DataSet Dim accs As String Public ORDEN_DB As OleDb.OleDbCommand Public D_Table As DataTable Private D_Adapter As OleDbDataAdapter Sub consulta() conexion.ACE.Click Call consulta() End Sub End Class .Close() End Sub Private Sub Button1_Click(ByVal sender As System. STUARDO CODIGO ORIGINAL LV-SISTEMAS MODIFICACIONES: WALTER STUARDO MONTERROSO MONZON Imports System.OleDb Public Class Form1 Dim conexion As New OleDbConnection("Provider=Microsoft.accdb") Dim adaptador As New OleDbDataAdapter("select * from BDConsulta".EventArgs) Handles Button1.Object.0. conexion) ORDEN_DB.ExecuteNonQuery() D_Adapter = New OleDbDataAdapter(ORDEN_DB) D_Table = New DataTable D_Adapter. Data Source=C:\Users\Server\Desktop\Consultas\CN.Data.

Close() Try TextBox2.OleDbCommand Public D_Table As DataTable Private D_Adapter As OleDbDataAdapter Dim seleccion As String Sub consulta() conexion.Show(ex.EventArgs) Handles TextBox1.ExecuteNonQuery() D_Adapter = New OleDbDataAdapter(ORDEN_DB) D_Table = New DataTable D_Adapter.Text = D_Table.Message) End Try End Sub Private Sub Button1_Click(ByVal sender As System.Rows(0)("ID") TextBox3.OleDbCommand(accs.OleDb Public Class Form1 Dim conexion As New OleDbConnection("Provider=Microsoft.OLEDB.Text = D_Table.DataSource = D_Table conexion.ACE.Rows(0)("DIRECCION") TextBox6.Rows(0)("APELLIDO") TextBox5.Open() If seleccion <> "todos" Then accs = "SELECT * FROM BDConsulta where " & ComboBox1.Text = D_Table.CONSULTA STRING BY LV-SISTEMAS FT. conexion) Dim ds As New DataSet Dim accs As String Public ORDEN_DB As OleDb. STUARDO CODIGO ORIGINAL LV-SISTEMAS MODIFICACIONES: WALTER STUARDO MONTERROSO MONZON Imports System.Text ORDEN_DB.accdb") Dim adaptador As New OleDbDataAdapter("select * from BDConsulta". conexion) ORDEN_DB. Data Source=C:\Users\Server\Desktop\Consultas\CN.Text = D_Table.Rows(0)("NOMBRE") TextBox4.TextChanged seleccion = TextBox1.EventArgs) Handles Button1.Object.Fill(D_Table) DataGridView1.Data.Click seleccion = "todos" Call consulta() End Sub Private Sub TextBox1_TextChanged(ByVal sender As System. ByVal e As System.CommandType = CommandType.Rows(0)("DPI") Catch ex As Exception MessageBox.0.Text = D_Table.12.Object.Text & " LIKE '" & seleccion & "' order by ID" Else accs = "SELECT * FROM BDConsulta order by ID" End If ORDEN_DB = New OleDb. ByVal e As System.Text seleccion = "%" & seleccion & "%" Call consulta() End Sub End Class .