You are on page 1of 1

Private cmb As SqlCommandBuilder

Public ds As DataSet = New DataSet()


Public da As SqlDataAdapter
Public comando As SqlCommand
Private Property dt As DataTable

Public Sub Consulta(ByVal sql As String, ByVal tabla As String)


cn.Open()
ds.Tables.Clear()
da = New SqlDataAdapter(sql, conexion)
cmb = New SqlCommandBuilder(da)
da.Fill(ds, tabla)
cn.Close()

End Sub

Function Insertar(ByVal sql)


cn.Open()
comando = New SqlCommand(sql, cn)
da = New SqlDataAdapter With {.SelectCommand = comando}
dt = New DataTable
da.Fill(dt)
Dim indice As Integer = 0
Dim dr As DataRow = dt.Rows(dt.Rows.Count - 1)
Dim i As Integer = dr(0)
cn.Close()
'If (i > 0) Then
' Return True
'Else
' Return False
'End If
Return i
End Function

You might also like