I got an error once I i run below coding,it give me error messages as No row at index 0.Pls help me slove this probelm.I think there is no row is datatable,So i want to know how to add row before it populate from data.

                       DataTable data = new DataTable();
                       data = D3.Tables[0];
                       string expression;
                       expression = "New_TE_CODE=TE_CODE";
                       DataRow[] foundRows;
                       DataSet D = new DataSet();
                        foundRows = data.Select(expression);
                        DataTable D1 = new DataTable();
                        for (int i = 0; i < foundRows.Length; i++)
                          D1.Rows[i]["TE_Code"] = foundRows[i][2];                               
                          D1.Rows[i]["New_TE_Code"]= foundRows[i][3];



Edited 3 Years Ago by mike_2000_17: Fixed formatting

This question has already been answered. Start a new discussion instead.