#Region " Imports "
Imports System.Data.SqlClient
Imports BD.ABD
Imports Funcion.Funcion
#End Region

Public Class Buscar

#Region " Variables "
    Dim ser As New BD.ABD
    Dim sql As String
    Dim cmd As SqlCommand
    Dim ds As DataSet
    Dim dr As SqlDataReader
    Dim da As SqlDataAdapter
    Dim cnn As SqlConnection
    Dim items As Long
#End Region
#Region " Ayuda en forma de Búsqueda en Ventana "
    Public Function AyudaBuscar(ByVal Descripcion As String, ByVal Codigo As String, ByVal tabla As String, Optional ByVal Orden As Integer = 0) As SqlDataReader
        cnn = New SqlConnection
        cnn = ser.Abrir()
        sql = ""
        Select Case Orden
            Case 0
                sql = "SELECT " & Descripcion & " AS Descripcion, " & Codigo & " AS Codigo FROM " & tabla & " ORDER BY " & Descripcion & ""        'asignacion de sintaxis sql para la modificación        oODBCConnection.Open()                              'abre la conexion con la base"
            Case 1
                sql = "SELECT " & Descripcion & " AS Descripcion, " & Codigo & " AS Codigo FROM " & tabla & " ORDER BY " & Codigo & ""        'asignacion de sintaxis sql para la modificación        oODBCConnection.Open()                              'abre la conexion con la base
        End Select
        Try                                                 'bloque try
            cmd = New SqlCommand(sql, cnn)     'creación dle comando sql con sql y la conexion1
            dr = cmd.ExecuteReader()                      'asignacion de comando de lectura a dr
        Finally                                             'final del bloque try
        End Try
        'cnn.Close()
        Return dr
    End Function
#End Region
End Class
