![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
#3
| |||
| |||
|
|
Hi Russ, There has been no response, so I will give this a go. First, if you get hold of the UniData 7.1 or UniVerse 10.1b client CD-ROM, you will find sample code in the VB.NET directory tree (see below). If you are unable to get the client CD, post an e-mail address and I can zip up the directory tree and e-mail it to you. I have found the following points helpful when setting up the uo session for an application: 1) Create a class to hold the session open and close methods. 2) These methods must be declared as 'Public Shared..' 3) Declared the session handle at the top of Form1 as 'Public Shared us1...' 4) Because the methods in your class are declared as 'Public Shared..', you do not have to initiate the class, you just call the methods (global functions, I think in older VB you would use a module rather than a class) I am not sure if the pe editions allow external connectons, I have heard a few people complain that they have been unable to connect through ODBC to the pe editions, but I have not tested if this is true. Just be aware there may be a restriction in the pe editions. The following is the sample VB.NET connect code from UniVerse 10.1b client: [ start insert ] Option Explicit On Option Strict On ' Add the classes in the following namespaces to our namespace Imports System Imports System.IO Imports System.Text Imports System.Collections Imports IBMU2.UODOTNET Class App Public Shared Function Main(ByVal args() As String) As Integer Dim us1 As UniSession = Nothing Try Console.WriteLine("Program started... ") us1 = UniObjects.OpenSession("xxxx", "xxxx", "xxxx", "xxxx", "uvcs") Catch e As Exception If Not (us1 Is Nothing) Then If (us1.IsActive) Then UniObjects.CloseSession(us1) us1 = Nothing End If End If Console.WriteLine("") Dim s As String s = "Connection Failed : " + e.Message Console.WriteLine(s) Finally If Not (us1 Is Nothing) Then If (us1.IsActive) Then Console.WriteLine("") Dim s As String s = "Connection Passed" Console.WriteLine(s) UniObjects.CloseSession(us1) Console.WriteLine("Program finished... ") End If End If End Try Console.Read() Return 0 End Function 'Main End Class 'App [ end insert ] HTH Regards Barry |
![]() |
| Thread Tools | |
| Display Modes | |
| |