HI
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();
                        D1.Columns.Add("TE_Code");
                        D1.Columns.Add("New_TE_Code");
                        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];
                       }

                         MessageBox.Show(D1.Rows.Count.ToString());

Thanks

Perhaps you should add rows to your D1 dataset?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.