PreviousNext
Help > Easycom .NET > System.Data.EasycomClient namespace > EacDataReader > Example with EacDataTable
Example with EacDataTable

 

Into this example, a EacDatatable is used to load a EacDataReader.

                        

                         string resultContent = "";

           using (var cmd = ConnectionIBM.CreateCommand())
           {
               cmd.CommandText = "SELECT * FROM EASYCOMXMP/SP_CUST where                                    (CUST_ID='C-17' OR CUST_ID='C-03')";
               using (
EacDataReader dr = (EacDataReader)cmd.ExecuteReader())
               {

                   
EacDataTable dataTable = new EacDataTable();

                   dataTable.
Load(dr);


                   foreach (
DataRow row in dataTable.Rows)
                   {
                       for (int i = 0; i < dataTable.Columns.Count; i++)
                       {
                           resultContent = resultContent + " - " +                                                row[i].ToString();
                       }
                       resultContent = resultContent + Environment.NewLine;
                   }

                   MessageBox.Show(resultContent.
ToString());
                   dr.
Close();
               }
               cmd.
Dispose();
           }