PreviousNext
Help > Easycom .NET > Easycom namespace > EasycomConnection > EasycomConnection Class
EasycomConnection Class

Namespace Easycom

 

Syntax

public class EasycomConnection : System.Object

 

Description

The EasycomConnection class represents a physical connection to the AS/400. Because this connection can be "pooled", when you close the object (using .Dispose() or .Close() method) the physical connection may remain open.

“System.Data.EasycomClient.EacConnection” is derived from this class. So, all properties and methods of EasycomConnection are accessible from an EacConnection (ADO .NET Driver) object.

 

A typical use of EasycomConnection object consists of filling the "ConnectionString property", and calling the "Open" method.

 

Example of use (C#)

EasycomConnection my_cnx;

           EasycomFile my_file;

           string result;

 

           my_cnx = new EasycomConnection();

my_cnx.ConnectionString = "Server=194.206.160.111;User. "

           my_cnx.Open();

           my_file = my_cnx.OpenFile("S_CUSTOMER");

           if (my_file.ReadKey(2156))

           {

result = my_file.GetValue("COMPANY").ToString() +  " - "+ my_file.GetValue("FIRSTNAME").ToString();

                 MessageBox.Show("Customer found : "+result);

           }

           else

                 MessageBox.Show("Customer not found!");

 

Example of use (VB.NET)

Dim my_cnx As EasycomConnection

Dim my_file As EasycomFile

Dim result As String

 

my_cnx = New EasycomConnection

my_cnx.ConnectionString = "Server=194.206.160.111;User"

my_cnx.Open()

my_file = my_cnx.OpenFile("S_CUSTOMER")

If (my_file.ReadKey(2156)) Then

result = my_file.GetValue("COMPANY").ToString() + " - " + my_file.GetValue("FIRSTNAME").ToString()

MessageBox.Show("Customer found : " + result)

Else

MessageBox.Show("Customer not found!")

End If