Private Sub Command1_Click()
  Dim objSession As Object    ' The Session to the database
  Dim objFile As Object       ' The file to open (VOC)
  Const UVE_NOERROR = 0       ' From UVOAIF.TXT - no error
  Const NETWORK_TCP = 2       ' From UVOAIF.TXT
  Const NETWORK_LANMAN = 1    ' From UVOAIF.TXT
  Const NETWORK_DEFAULT = 0   ' No preference
  ' The registered name of a database Session - Version 1
  Const UV_SESSION_OBJECT = "UniObjects.unioaifctrl"
  '
  ' Create a Session object to work with
  ' - This is a contrived sample, in a full application the Session object
  ' - would typically be a Global variable that is set once maybe
  ' - response to a menu selection (e.g. Connect) on the main form.
  '
  Set objSession = CreateObject(UV_SESSION_OBJECT)
  If objSession Is Nothing Then
    MsgBox "NB. Errors will be reported by Visual Basic"
    ' NB. Errors will be reported by Visual Basic
    Exit Sub ' End the program
  End If
  objSession.UserName = "datadude" 'Input.Box ("User Name:","Login")
  objSession.Password = "abc" 'Input.Box ("Password:","Password")\
  objSession.AccountPath = "fredtest"
  objSession.HostName = "aadate9"


  objSession.Transport = NETWORK_LANMAN
  '
  ' Establish a connection to the database server. By default it displays
  ' a dialog box to request the HostName and AccountPath property values.
  '
  objSession.Connect
  If objSession.IsActive Then
    '
    ' Continue with the program, then close the session...
    '
    If objSession.HostType = UVT_UNIX Then
      MsgBox "You are connected to a UNIX server"
    End If
    
    Dim GetOrderData As Object
    Set GetOrderData = objSession.Subroutine("TTT", 2)
    GetOrderData.SetArg 0, Text1.Text
   'GetOrderData.SetArg 0, "0123456"
   'GetOrderData.SetArg 1, DisplayType
    GetOrderData.Call
    FirstName = GetOrderData.GetArg(1)
    Text2.Text = FirstName
   'ErrorCode = GetOrderData.GetArg(2)
    
    objSession.Disconnect
  Else
    '
    ' Check for Session errors - display message box with error code
    ' No error means the user cancelled the connection dialog box
    '
    If objSession.Error <> UVE_NOERROR Then
      MsgBox "Unable to open connection:- " & objSession.Error
    End If
  End If
End Sub

Hosted by www.Geocities.ws

1