这是什么错误?关于数据绑定的问题 textBox3.DataBindings.Add(new Binding("Text", Ds1.Tables[0], "UserName"));无法绑定到 DataSource 的属性或列 UserName。参数名: dataMember 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 后台的数据库是SQL server 2000,数据库中的字段类型为varchar 错不在这,贴出sql+前台绑定语句 SqlDataAdapter thisAdapter = new SqlDataAdapter( "insert into logonuser(username,userpwd) values('" + textBox3.Text + "','" + textBox4.Text + "')", thisConnection); SqlDataAdapter thisAdapter = new SqlDataAdapter( "select * from customers", thisConnection); SqlDataAdapter thisAdapter1 = new SqlDataAdapter( "select username,userpwd from logonuser", thisConnection); SqlCommandBuilder thisBuilder = new SqlCommandBuilder(thisAdapter); SqlCommandBuilder thisBuilder1 = new SqlCommandBuilder(thisAdapter1); DataSet Ds = new DataSet(); thisAdapter.Fill(Ds,"Customer"); DataSet Ds1 = new DataSet(); thisAdapter.Fill(Ds1, "logonuser"); textBox1.DataBindings.Clear(); textBox1.DataBindings.Add(new Binding("Text", Ds.Tables[0], "companyname")); textBox2.DataBindings.Add(new Binding("Text", Ds.Tables[0], "City")); listBox1.DataSource = Ds.Tables[0]; listBox1.DisplayMember = "companyname"; textBox3.DataBindings.Clear(); textBox3.DataBindings.Add(new Binding("Text", Ds1.Tables[0], "username")); textBox4.DataBindings.Add(new Binding("Text", Ds1.Tables[0], "userpwd")); listBox2.DataSource = Ds1.Tables[0]; listBox2.DisplayMember = "UserName";提示这句错了。 textBox3.DataBindings.Add(new Binding("Text", Ds1.Tables[0], "username"));无法绑定到 DataSource 的属性或列 UserName。参数名: dataMember 是不是我后台数据库的这张表建的有问题啊,我换了一张表就能进行绑定了,这是为什么??这是我表的定义的文本CREATE TABLE logonuser( Userid smallint IDENTITY(1,1) PRIMARY KEY CLUSTERED, UserName varchar(50) NOT NULl, UserPwd varchar(50) NOT NULl )大家帮我看看 DataSet Ds1 = new DataSet(); thisAdapter.Fill(Ds1, "logonuser"); //这改一下thisAdapter1.Fill(Ds1, "logonuser"); 将递归函数改写成非递归形式 请大家帮忙看看这个socket收发文件。 C# WinForm SQL Server 求前辈们帮小弟做两道题,C#高手请进!!! 在线等... (高分) C#连接数据库进行密码修改的问题 急!vs2005 access数据的查询问题 GDI+的问题! mdi子窗体FormBorderStyle=none,WindowState=normal,在show出窗体时为什么标题栏会闪一下? 请问怎样用C#访问excel中某一特定页的特定的单元格 如何刷新主窗口呢? listview && listviewitem 求救!! 不可思意了!!!
"insert into logonuser(username,userpwd) values('" + textBox3.Text + "','" + textBox4.Text + "')", thisConnection);
"select * from customers", thisConnection); SqlDataAdapter thisAdapter1 = new SqlDataAdapter(
"select username,userpwd from logonuser", thisConnection); SqlCommandBuilder thisBuilder = new SqlCommandBuilder(thisAdapter); SqlCommandBuilder thisBuilder1 = new SqlCommandBuilder(thisAdapter1);
DataSet Ds = new DataSet();
thisAdapter.Fill(Ds,"Customer");
DataSet Ds1 = new DataSet();
thisAdapter.Fill(Ds1, "logonuser");
textBox1.DataBindings.Clear();
textBox1.DataBindings.Add(new Binding("Text", Ds.Tables[0], "companyname"));
textBox2.DataBindings.Add(new Binding("Text", Ds.Tables[0], "City"));
listBox1.DataSource = Ds.Tables[0];
listBox1.DisplayMember = "companyname";
textBox3.DataBindings.Clear();
textBox3.DataBindings.Add(new Binding("Text", Ds1.Tables[0], "username"));
textBox4.DataBindings.Add(new Binding("Text", Ds1.Tables[0], "userpwd"));
listBox2.DataSource = Ds1.Tables[0];
listBox2.DisplayMember = "UserName";提示这句错了。
textBox3.DataBindings.Add(new Binding("Text", Ds1.Tables[0], "username"));
无法绑定到 DataSource 的属性或列 UserName。
参数名: dataMember
(
Userid smallint
IDENTITY(1,1)
PRIMARY KEY CLUSTERED,
UserName varchar(50) NOT NULl,
UserPwd varchar(50) NOT NULl
)大家帮我看看
thisAdapter.Fill(Ds1, "logonuser"); //这改一下thisAdapter1.Fill(Ds1, "logonuser");