David Green

David Green

  • NA
  • 7
  • 0

Linq to datatable help

Aug 11 2011 5:55 PM
I am trying to load data from my database through a linq command
here is my code
DataTable dtBooking = new DataTable();
  dtBooking = (GetGeneric.GetInstance<AdminDriverHelper>().GetDriversHolidays(""));
  //dtBooking.Columns.Add("DriverID", Type.GetType("System.Int64"));
  //dtBooking.Columns.Add("DriverDate", Type.GetType("System.DateTime"));
  //dtBooking.Columns.Add("DriverName", Type.GetType("System.String"));
  //int idCount = 1;
 
 
  for (int i = 1; i <= 5; i++)
   {
  DataRow dr;
  dr = dtBooking.NewRow();
  dr["DriverID"] = dtBooking.Rows[0]["DriverID"];
  dr["DriverName"] = dtBooking.Rows[0]["DriverName"];
  dr["DriverDate"] = dtBooking.Rows[0]["DriverDate"];
 
 dtBooking.Rows.Add(dr);
  }
  return dtBooking;
  }
but I get this error
System.ArgumentException: Column '' does not belong to table Table1.
I am sure its is how I am calling the sproc, but I am unsure
Can anyone help?


Answers (1)