textBox3.DataBindings.Add(new Binding("Text", Ds1.Tables[0], "UserName"));无法绑定到 DataSource 的属性或列 UserName。
参数名: dataMember

解决方案 »

  1.   

    后台的数据库是SQL server 2000,数据库中的字段类型为varchar
      

  2.   

    错不在这,贴出sql+前台绑定语句
      

  3.   

    SqlDataAdapter thisAdapter = new SqlDataAdapter(
                    "insert into logonuser(username,userpwd) values('" + textBox3.Text + "','" + textBox4.Text + "')", thisConnection);
      

  4.   

    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
      

  5.   

    是不是我后台数据库的这张表建的有问题啊,我换了一张表就能进行绑定了,这是为什么??这是我表的定义的文本CREATE TABLE logonuser
    (
       Userid  smallint
          IDENTITY(1,1)
          PRIMARY KEY CLUSTERED,
       UserName        varchar(50)     NOT NULl,
         UserPwd        varchar(50)     NOT NULl 
    )大家帮我看看
      

  6.   

    DataSet Ds1 = new DataSet();
     thisAdapter.Fill(Ds1, "logonuser");        //这改一下thisAdapter1.Fill(Ds1, "logonuser");