PreviousNext
Help > Use example : EacXML class > Develop an application Windows Form > Open a connection with AS/400
Open a connection with AS/400

 

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;

                    }