1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
|
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
' Add a reference to IBM AS/400 Client Access Express
' ActiveX Object Library
' (C:\Program Files\IBM\Client Acccess\Shared\cwbx.dll
Dim oAS400 As cwbx.AS400System
Dim oDTAQ As cwbx.DataQueue
Dim myConv As cwbx.StringConverter
Dim sWriteString As String
Try
' Create objects
oAS400 = New cwbx.AS400System
oDTAQ = New cwbx.DataQueue
myConv = New cwbx.StringConverter
' Define the AS400 by name - change value in quotes
oAS400.Define(Me.ServerTextBox.Text)
' Supply user id and password for AS400
' Change values in quotes
oAS400.UserID = Me.UserTextBox.Text
oAS400.Password = Me.PassWordTextBox.Text
' oAS400.Connect(cwbx.cwbcoServiceEnum.cwbcoServiceDataQueues)
' Connect to Data Queue Service
Debug.Print("about to connect")
oAS400.Connect(cwbx.cwbcoServiceEnum.cwbcoServiceDataQueues)
' Define Data Queue object - change values in quotes
oDTAQ.LibraryName = Me.LibraryTextBox.Text
oDTAQ.QueueName = Me.DataQueueTextBox.Text
oDTAQ.system = oAS400
Debug.Print("SingOn : " + oAS400.SignonDate.ToString)
Debug.Print("about to connect")
sWriteString = Me.EnvoiTextBox.Text
'oDTAQ.MaximumRetrievalLength = 2048
Debug.Print("about to write to dq")
oDTAQ.Write(sWriteString) 'oDTAQ.Write(myConv.ToBytes(sWriteString), True)
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub |
Partager