I am working with a multi-value database that is currently using IBM U2 (now Rocket Software)'s UniObjects software to connect to a Universe 9.+ system. This is not UniObjects for .NET as put out by Rocket Software for Universe 10+ and 11+ systems. The only examples I have to use to try to connect to the Universe 9+ system are using Visual Basic 6.0 and I need to use C#. Can anyone show me HOW to connect to a Universe 9+ system in C#? Basically, I'm trying to translate what I would use in VB 6 over to C# in order to connect to that system. Thanks for any and all help you can provide. Some of the examples in the documentation are as follows:
Sub SampleFile ()
' SampleFile
'
' This routine creates a new session and opens the chosen
account's VOC
' file. The user is asked for a record id from VOC (e.g.
RELLEVEL), which
' is read and displayed in a message box. Finally the session
is closed.
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
' 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 in
' - response to a menu selection (e.g. Connect) on the main
form.
'
Set objSession = CreateObject(UV_SESSION_OBJECT)
If objSession Is Nothing Then
' NB. Errors will be reported by VB
Exit Sub ' End the program
End If
objSession.UserName = Input.Box ("User Name:","Login")
objSession.Password = Input.Box ("Password:","Password")
'
' 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
'
' Open the VOC file
'
Set objFile = objSession.OpenFile("VOC")
If objFile Is Nothing Then
MsgBox "Unable to open VOC file (" & objSession.Error &
")"
Exit Sub ' End the program
End If
'
' Read user entered record from the VOC e.g. RELLEVEL
'
objFile.RecordId = InputBox("Enter Record Id:", "Record Id")
objFile.Read
File Object: Example 3-85
/productinfo/alldoc/UNIVERSE10/uv
objs/Ch3
If objFile.Error = UVE_NOERROR Then
' Display the record in a message box and close file
MsgBox objFile.Record
objFile.CloseFile ' Close the file - Good practice
Else
MsgBox "Unable to read (" & objFile.RecordId & ") record
from
å VOC " & objFile.Error
End If
'
' Close the session
'
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
(I can program very well with C#. What I need is an example or two on how to connect to Universe 9+ and how to instantiate what "UniObjects" objects I need in C#. I know for instance that I need to create a session object, but VB 6 code won't tell me how to do that in C# ...)