PreviousNext
Help > Use example: EacConnection and  EacCommand classes
Use example: EacConnection and  EacCommand classes

 

This example is available into the installation directory: C:\Users\Public\Documents\Easycom For .NET Samples\EasycomVB.

It has been developed in VB with Visual Studio.

Into this exemple, we execute the EASYCOMXMP/RPCSAMPLE program.

This program has been first described with the RPC/Data Queue Configurator.

Imports System.Data.EasycomClient

 

       Dim res As Int32

       Using easyConn As System.Data.EasycomClient.EacConnection = New       System.Data.EasycomClient.EacConnection()

            easyConn.ConnectionString = "Server=power8;User Id=;Password=;Init Libl=easycomxmp"

            easyConn.Open()

 

            Using easyComm As System.Data.EasycomClient.EacCommand = New System.Data.EasycomClient.EacCommand()

 

                With easyComm

 

                    .Connection = easyConn

                    .CommandType = CommandType.StoredProcedure

                    .CommandText = "*PGM/RPCSAMPLE"

 

                    With .Parameters.Add("OP1", DbType.Double, 1)

                        .Direction = ParameterDirection.Input

                        .Value = OP1.Text

                    End With

                    With .Parameters.Add("STR1", DbType.StringFixedLength, 1)

                        .Direction = ParameterDirection.Input

                        .Value = STR1.Text

                    End With

                    With .Parameters.Add("OP2", DbType.Double, 1)

                        .Direction = ParameterDirection.InputOutput

                        .Value = OP2.Text

                    End With

                    With .Parameters.Add("STR2", DbType.StringFixedLength, 1)

                        .Direction = ParameterDirection.InputOutput

                        .Value = STR2.Text

                    End With

                    With .Parameters.Add("OP3", DbType.Double, 1)

                        .Direction = ParameterDirection.Output

                    End With

 

                End With

 

                res = easyComm.ExecuteNonQuery()

 

                OP1.Text = easyComm.Parameters.Item(0).Value.ToString()

                STR1.Text = easyComm.Parameters.Item(1).Value.ToString()

                OP2.Text = easyComm.Parameters.Item(2).Value.ToString()

                STR2.Text = easyComm.Parameters.Item(3).Value.ToString()

                OP3.Text = easyComm.Parameters.Item(4).Value.ToString()

 

            End Using

            easyConn.Close()

 

        End Using