Revision: 70401
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at February 5, 2016 03:19 by systemergon
Initial Code
''' <summary> ''' Regresa un dataset mediante parametro de SP a ejecutar regresa DataTable ''' </summary> ''' <param name="spExecute"> Llamada a sp con parametros SQLSERVER</param> ''' <returns></returns> ''' <remarks></remarks> Function executeSPdt(ByVal spExecute As String) As DataTable Dim da As SqlDataAdapter = Nothing Dim res As New DataTable Try Me.cmd = New SqlCommand(spExecute, conecctedDB()) Me.da = New SqlDataAdapter(Me.cmd) Me.da.Fill(res) Me.con.Close() Catch ex As SqlException Throw New System.Exception("Error de conexion a la basde de datos: executeSP", ex) Finally If Not (Me.cmd Is Nothing) Then Me.cmd.Dispose() If Not (Me.da Is Nothing) Then Me.da.Dispose() End Try 'Valor resultado Return res End Function ''' <summary> ''' Regresa un dataset mediante parametro de SP a ejecutar regresa DataSet ''' </summary> ''' <param name="spExecute"> Llamada a sp con parametros SQLSERVER</param> ''' <returns></returns> ''' <remarks></remarks> Function executeSPds(ByVal spExecute As String) As DataSet Dim da As SqlDataAdapter = Nothing Dim res As New DataSet Try Me.cmd = New SqlCommand(spExecute, conecctedDB()) Me.da = New SqlDataAdapter(Me.cmd) Me.da.Fill(res) Me.con.Close() Catch ex As SqlException Throw New System.Exception("Error de conexion a la basde de datos: executeSP", ex) Finally If Not (Me.cmd Is Nothing) Then Me.cmd.Dispose() If Not (Me.da Is Nothing) Then Me.da.Dispose() End Try 'Valor resultado Return res End Function ''' <summary> ''' Ejecuta SP UPDATE y regresa los RowsActualizados ''' </summary> ''' <param name="spExecute"></param> ''' <returns></returns> ''' <remarks></remarks> Function executeSPGetRowsAffected(ByVal spExecute As String) As System.Int64 Dim rowsAffected As Integer = 0 Try Me.cmd = New SqlCommand(spExecute, conecctedDB()) 'Executa el comando y regresa rows afectados rowsAffected = Me.cmd.ExecuteNonQuery() Return rowsAffected Catch ex As SqlException Throw New System.Exception("Error de conexion a la basde de datos executeSPGetRowsAffected - " + spExecute, ex) Finally If Not (Me.cmd Is Nothing) Then Me.cmd.Dispose() If Not (Me.da Is Nothing) Then Me.da.Dispose() If Not (Me.con Is Nothing) Then Me.con.Close() End Try Return rowsAffected End Function
Initial URL
Initial Description
Ejecutar sp retornando un datatable, Ejecutar sp retornando un dataset, Ejecutar sp Update retornando los registros actualizados
Initial Title
Trabajando SP con DataTable , Dataset y Update origen desconectado
Initial Tags
update
Initial Language
VB.NET