Te pego un programa de prueba.
-------------8<-------------8<---- CORTAR
INICIO ---------8<-------------8<-------------8<
Dim WithEvents conADO As ADODB.Connection
'Dim rsADO As ADODB.Recordset
Dim rsADO As ADODB.Recordset
Private Sub Command1_Click()
Screen.MousePointer = vbHourglass
'se crea y abre objeto conADO (conexi�n ADO)
Set conADO = New ADODB.Connection
With conADO
.Provider = "MSDASQL.1"
.ConnectionString = "DSN=as400.prueba"
.ConnectionTimeout = 10
.CursorLocation = adUseClient
End With
Text1.Text = "Conectando con origen de datos " & conADO.ConnectionString
conADO.Open
End Sub
Private Sub conADO_ConnectComplete(ByVal pError As ADODB.Error, adStatus As
ADODB.EventStatusEnum, ByVal pConnection As ADODB.Connection)
Screen.MousePointer = vbDefault
Text1.Text = ""
If adStatus <> adStatusErrorsOccurred Then
MsgBox "Conexi�n establecida con origen de datos " + vbCrLf &
conADO.ConnectionString, vbInformation, " "
Else
MsgBox "No se pudo establecer conexi�n con origen de datos " +
vbCrLf & conADO.ConnectionString, vbInformation, " "
End
End If
End Sub
Private Sub Command2_Click()
Dim sensql As String
Dim errLoop As ADODB.Error
Dim paramet As String * 8
On Error GoTo ControlError
paramet = "MIGUEL12"
Screen.MousePointer = vbHourglass
'sensql = "call prueba.hojaoedita"
'sensql = "call prueba.somete "
'sensql = "call prueba.hojaoep ('00001111', 'MMM' )"
'sensql = "call prueba.hojaoep ('" & paramet & "')"
sensql = "call prueba.incpyvto ('201', '2103', '31032001' )"
Print sensql
conADO.Execute (sensql)
Text1.Text = "ejecutado pgm"
ControlError:
Text1.Text = Text1.Text & vbCrLf & "se encontraron " & conADO.Errors.Count &
" errores " & vbCrLf
For Each errLoop In conADO.Errors
Text1.Text = Text1.Text & " descripci�n :" & errLoop.Description & vbCrLf
Text1.Text = Text1.Text & " NativeError :" & errLoop.NativeError & vbCrLf
Text1.Text = Text1.Text & " Number :" & errLoop.Number & vbCrLf
Text1.Text = Text1.Text & " source :" & errLoop.Source & vbCrLf
Text1.Text = Text1.Text & " SQLstate :" & errLoop.SQLState & vbCrLf
'Text1.Text = "sql status : " & Text1.Text + vbCrLf &
conADO.Errors.Item.SQLState
Next
Screen.MousePointer = vbDefault
End Sub
Private Sub Form_Unload(Cancel As Integer)
conADO.Close
End Sub
-------------8<-------------8<---- CORTAR
FIN---------8<-------------8<-------------8<
----- Original Message -----
From: "Andreu Sabate" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, May 22, 2002 5:48 PM
Subject: Llamada a PGM desde VB
Hola a todos,
se que esta cuestion ya fue planteada en el foro...
Necesitaria saber como llamar a un programa (con par�metros) del AS400 desde
Visual Basic.
Muchas gracias por vuestras respuestas.
Andreu.-
This e-mail has been sent on behalf of the Kellogg Group of European
Companies
("Kellogg Group"). Any views expressed in this e-mail (including
attachments)
are of the author and do not necessarily represent those of the Kellogg
Group.
Its contents are confidential to the intended recipient. If you are not the
intended recipient: (1) you must not disclose, copy or distribute its
contents
in any way; (2) please forward the e-mail to
[EMAIL PROTECTED]
and then delete it from your system. Details of members of the Kellogg Group
are
available upon request from the e-mail address included in this disclaimer.
Kellogg Management Services (Europe) Limited ("KMS") has scanned this e-mail
for
viruses on behalf of the Kellogg Group but neither KMS nor any other company
within the Kellogg Group accepts any responsibility for viruses once this
e-mail
has been transmitted. You should scan attachments (if any) for viruses.
_____________________________________________________
Forum.HELP400 es un servicio m�s de NEWS/400.
� Publicaciones Help400, S.L. - Todos los derechos reservados
http://www.help400.es
_____________________________________________________
Para darte de baja, env�a el mensaje resultante de pulsar
mailto:[EMAIL PROTECTED]?body=AVE
_____________________________________________________
Forum.HELP400 es un servicio m�s de NEWS/400.
� Publicaciones Help400, S.L. - Todos los derechos reservados
http://www.help400.es
_____________________________________________________
Para darte de baja, env�a el mensaje resultante de pulsar
mailto:[EMAIL PROTECTED]?body=LEAVE