'System.Data.DataRowView'不包含名称为'FullName'的属性. [英] 'System.Data.DataRowView' does not contain a property with the name 'FullName'.

查看:77
本文介绍了'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)

推荐答案

我猜你正在绑定到FullName在您的网格中,但FullName不是您查询中的一列
I''m guessing you''re binding to FullName in your grid, yet FullName is not a column in your query


这篇关于'System.Data.DataRowView'不包含名称为'FullName'的属性.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆