1
Reply

c#.net

poonam tyagi

poonam tyagi

Aug 12 2014 10:28 AM
566
Input array is longer than the number of columns in this table. why this error occur in my code
 for (int i = 0; i < dataGridView4.Rows.Count-1; i++)
                {
                    //for (int j = 0; j < dataGridView4.Columns.Count; i++)
                    //{
                        //for (int i = 0; i < dataGridView4.HeaderRow.Cells.Count; i++)
                        //{
                        dt.Rows.Add(dataGridView4.Rows[i].Cells[0].Value.ToString());
                        dt.Rows.Add(dataGridView4.Rows[i].Cells[1].Value.ToString());
                        dt.Rows.Add(dataGridView4.Rows[i].Cells[2].Value.ToString());
                        dt.Rows.Add(dataGridView4.Rows[i].Cells[3].Value.ToString());
                        dt.Rows.Add(dataGridView4.Rows[i].Cells[13].Value.ToString());
                        dt.Rows.Add(dataGridView4.Rows[i].Cells[18].Value.ToString());
                        dt.Rows.Add(dataGridView4.Rows[i].Cells[19].Value.ToString());
                        dt.Rows.Add(dataGridView4.Rows[i].Cells[21].Value.ToString());
                        dt.Rows.Add(dataGridView4.Rows[i].Cells[22].Value.ToString());
                        dt.Rows.Add(dataGridView4.Rows[i].Cells[23].Value.ToString());
                        da = new OleDbDataAdapter();
                        da.Fill(d, "dt");
                }

Answers (1)