作者热门文章
- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我正在使用 C# 处理数据库,当我点击显示按钮时出现错误:
Error:
Cannot bind to the property or column LastName on the DataSource. Parameter name: dataMember
代码:
private void Display_Click(object sender, EventArgs e)
{
Program.da2.SelectCommand = new SqlCommand("Select * From Customer", Program.cs);
Program.ds2.Clear();
Program.da2.Fill(Program.ds2);
customerDG.DataSource = Program.ds2.Tables[0];
Program.tblNamesBS2.DataSource = Program.ds.Tables[0];
customerfirstname.DataBindings.Add(new Binding("Text", Program.tblNamesBS2, "FirstName"));
customerlastname.DataBindings.Add(new Binding("Text", Program.tblNamesBS2, "LastName")); //Line Error occurs on.
}
不确定这意味着什么,任何人都可以提供帮助,如果我注释掉最后两行,它将正确显示。
最佳答案
如果绑定(bind)到 NULL 对象,您也会遇到此错误。
关于c# - 数据源错误 : "Cannot Bind to property or Column",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11645551/
我是一名优秀的程序员,十分优秀!