asp.net - 数据绑定(bind) : 'System.Data.DataRowView' does not contain a property with the name 'Driver_Name'

标签 asp.net c#-4.0

 string[] Parameters = new string[3] { "@USER_ID", "@Company_ID", "@DRIVER_NAME" };
    string[] DbTypes = new string[3] { "varchar", "int", "varchar" };
    string[] ParameterTypes = new string[3] { "input", "input", "input" };
    string[] values = new string[3] { (Session["UserID"].ToString()), ddlCompany.SelectedValue.ToString(), txt_DRIVER_NAME.Text.Trim() };
    string[] Lengths = new string[3] { "50", "5", "20" };

    DataUtility du = new DataUtility();
    DataSet ds = du.returnDataSet(CommandType.StoredProcedure, "Driver_Zone_Wise", Parameters, DbTypes, ParameterTypes, values, Lengths);

    lb_DriverList.DataTextField = "Driver_Name";
    lb_DriverList.DataValueField = "DRIVER_ID";

    lb_DriverList.DataSource = ds.Tables[0];
    ****lb_DriverList.DataBind();****

    lb_DriverList.Items.Insert(0, new ListItem("Select Vehicle", "0"));

    lb_DriverList.SelectedValue = "0";

}

最佳答案

错误表明您的查询结果中没有 Driver_Name

检查您的查询和 ds.Tables[0] 并查看您是否拥有 Driver_Name 列。

编辑-1

检查您的过程Driver_Zone_Wise,确保您返回的列名为Driver_Name

关于asp.net - 数据绑定(bind) : 'System.Data.DataRowView' does not contain a property with the name 'Driver_Name' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20628126/

相关文章:

c# - 使用 ADFS 2.0 的单点登录

c#-4.0 - 使用 Parallel.Invoke 执行带参数的方法

c# - .Net 从哪个版本开始支持 httpclient

jquery - json 中的最大字符串参数长度

javascript - ASPxMenu - 单击而不是悬停打开子菜单 (dx :ASPxMenu)

.net - 适用于 .NET 的嵌入式 CMS

asp.net - 为什么 while 循环中保留数组中的值? (VB.NET)

c# - 如何将 HTML 代码放入 .resx 资源文件?

c# - 如何将数据表设置为 WPF 数据网格 C#?

asp.net-mvc - MVC4 HTML.ValidationMessageFor 不显示验证消息