Link to home
Start Free TrialLog in
Avatar of thomasm1948
thomasm1948Flag for United States of America

asked on

c# Input array is longer than the number of columns in this table

Hi All,

I have an datatable that is filled from a quickbooks.  what i need to do next select the values by class name.  when trying this I get "Input array is longer than the number of columns in this table".  Below is my code

string selectrows = "ClassName = " + "'" + bobArray[i].ToString() + "'";
 for (int j = 0; j < dt_tr_classMerge.Columns.Count ; j++)
   {
                                        
       string colName = dt_tr_classMerge.Columns[j].ColumnName;
      dt_tr_class.Columns.Add(colName, typeof(String));
          }
          DataRow[] results = dt_tr_classMerge.Select(selectrows);
        dt_tr_class.Rows.Add(results);
         //dt_tr_classMerge.Select(selectrows);
         //
         //dt_tr_class.Rows.Add(dt_tr_classMerge.Select(selectrows));
     SaveReportDataToFile(dt_tr_class, tr_class, rp_path);

Open in new window


I am not sure what I am doing wrong

Thank you for your help in advance
ASKER CERTIFIED SOLUTION
Avatar of thomasm1948
thomasm1948
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Gustav Brock
OK, then please close the question.

/gustav
Avatar of thomasm1948

ASKER

I figured it out