Public Function RegCountTable(ByVal Sql As String, ByVal ConnectionString As String) As Int32
'ejemplo parámetro Sql = "select count(*) from nombre_tabla"
Dim res As Int32 = -1
Try
Dim cn As New SqlConnection(ConnectionString)
cn.Open()
Dim cmd As New SqlCommand(Sql, cn)
res = Convert.ToInt32(cmd.ExecuteScalar())
cn.Close()
cn = Nothing
Catch ex As Exception
Debug.WriteLine(Sql & " " & ex.Message)
End Try
Return res
End Function
Suscribirse a:
Enviar comentarios (Atom)
VBA Access. Redondeo de números decimales con el método medio redondeo. Alternativa a la función Round (bankers round)
Private Function Redondeo(ByVal Numero As Variant, ByVal Decimales As Integer) As Double 'Aplica método medio redondeo (half round ...
-
Option Compare Database Option Explicit '***************************** ' 'Ejemplo de uso ' 'selecciona 1 ficher...
-
Option Compare Database Option Explicit 'Zip / UnZip file or folder 'http://www.codekabinett.com/rdumps.php?Lang=2&targetDoc...
No hay comentarios:
Publicar un comentario