本文介绍了'System.Data.DataRowView'不包含名称为'FullName'的属性.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
伙计们正在根据选择的日期填充gridview
我收到此错误:DataBinding:``System.Data.DataRowView''不包含名称为``FullName''的属性.
这就是我的填充方式
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)
推荐答案
这篇关于'System.Data.DataRowView'不包含名称为'FullName'的属性.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!