In this example, we use a first Form to manage the connection with the AS400 machine:
To open a connection, we use the following class:
Easycom.EasycomConnection
and we define the following property:
public static EasycomConnection Connection;
A click on the “Connect” button will cause the following treatment:
if (textBoxServer.Text != "" && textBoxUser.Text != "" && textBoxPwd.Text != "")
{
Connection = new EasycomConnection();
Connection.ConnectionString = "Server=" + textBoxServer.Text + ";User Id=" + textBoxUser.Text + ";Password=" + textBoxPwd.Text + ";Pooled=False";
try
{
Connection.Open();
}
catch (Exception exp)
{
MessageBox.Show("Connection failed:" + exp.Message);
Cursor.Current = Cursors.Default;
}