RE:Procedimiento almacenado desde VB
Debes hacer referencia a Microsoft ActiveX ADO
Global cn As ADODB.Connection
Global cmd1 As ADODB.Command
Global rsset As ADODB.Recordset
Private Sub Command1_Click()
If Command1.Caption = "Connect" Then
With cn
.ConnectionString "DSN=MyDSN;UID=MyUser;PWD=MyPassword;DATABASE=MyDB"
.Open
.CursorLocation = adUseClient
End With
Set rsset.ActiveConnection = cn
Command2.Enabled = True
Command1.Caption = "Disconnect"
Label1.Caption = "ON"
Else
Command2.Enabled = False
Command1.Caption = "Connect"
Label1.Caption = "Off"
Set rsset.ActiveConnection = Nothing
cn.Close
End If
End Sub
Private Sub Command2_Click()
rsset.Open "EXEC " & Text1.Text
If rsset(0) <> -1 Then
Print rsset(0)
Label2.Caption = "Sucessfull"
Else
Label2.Caption = "Wrong Execute"
End If
rsset.Close
End Sub
Private Sub Form_Load()
Set cn = New ADODB.Connection
Set rsset = New ADODB.Recordset
End Sub
Private Sub Form_Unload(Cancel As Integer)
' Desconecto y cierro mi conexion.
Set rsset.ActiveConnection = Nothing
cn.Close
End Sub