Hi,
I have one data table having datas from DB
tried but new coloumn started from 6th row of DT.5 rows are loaded from db.new coloumn started from 6th but 0th position
once the data table loaded i need to add one "Name" colum in the first position.My code is not giving a proper structure after adding new data column. What error i am doing here?
using (var adapter = new OdbcDataAdapter(command)) { command.CommandTimeout = 280; var table = new DataTable(tableName); if (tableName == "TestData") { var pathC = @"H:\file\data\names.txt"; string[] result = File.ReadAllLines(pathC); DataColumn Col = table.Columns.Add("Name", typeof(String)); Col.SetOrdinal(0); // set column to first position int i = 0; foreach (DataRow row in table.Rows) { //need to set value to NewColumn column row["Name"] = result[i]; i++; } } adapter.Fill(table); return table; }