Hi guys am populating a gridview according to selected date
I get this error:DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'FullName'.
this how i populate
#region Load grdAvailableStaff Slots When Date Is Selected
public void loadGrdAvailableStaffSlotsWhenDateIsSelected()
{
DataTable dt = new DataTable();
systemBusinessLayer = new BusinessLayer();
dt = systemBusinessLayer.grid(DatePicker.Text);
grdAvailableStaff.DataSource = dt;
grdAvailableStaff.DataBind();
}
#endregion
Code in my business layer
public DataTable grid(string date)
{
using (SqlConnection con = new SqlConnection(ConnString))
{
SqlCommand cmd = new SqlCommand("procAvailableStuff", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add(new SqlParameter("@Date", SqlDbType.NVarChar));
cmd.Parameters["@Date"].Value = date;
DataTable dTable = new DataTable("Fullname");
SqlDataAdapter adapter = new SqlDataAdapter(cmd);
adapter.Fill(dTable);
return dTable;
}
}
Below is my storedprocedure
SELECT DISTINCT Slots.EmpRecNumber AS 'RecordNumber' ,Employee.EmpName+' '+Employee.EmpSurname AS 'EmployeeName', Slots.Timeslot, Slots.Date, Slots.SlotID,Employee.EmpEmail
FROM Employee INNER JOIN
Slots ON Employee.EmpRecNumber = Slots.EmpRecNumber
WHERE Slots.status='a' AND Slots.Date=@Date AND Slots.EmpRecNumber IN (SELECT EmpRecNumber
FROM Employee)