Imports System.Data.SqlClient
Imports BD.ABD

Public Class Contabilidad
    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 New SqlConnection
    Public Function VerificarMadre(ByVal cuenta_contable As Long, ByVal nombre_tabla As String) As Boolean
        ser = New BD.ABD
        cnn = ser.Abrir
        sql = ""
        sql = "SELECT MAX(" & cuenta_contable & ") AS existe FROM " & nombre_tabla & ""
        Try
            cmd = New SqlCommand(sql, cnn)
            dr = cmd.ExecuteReader()
            Try
                dr.Read()
                Return dr("existe")
            Catch
                Return 0
            Finally
                dr.Close()
                cnn.Close()
            End Try
        Finally
        End Try
    End Function
End Class
