呵呵
vs.net还没有这么智能把pb应该可以

解决方案 »

  1.   

    SqlDataAdapter daa=new SqlDataAdapter("select Name from table1",sqlConnection1);\\除了MissingSchemaAction外,你也可以使用FillSchema获取构架,注意它们是有区别的,分别适用于不同的条件
    daa.MissingSchemaAction=MissingSchemaAction.AddWithKey;
    DataSet ds=new DataSet();
    daa.Fill(ds,"abc");
    textBox1.DataBindings.Add("Text",ds.Tables["abc"],"Name");
    textBox1.MaxLength=ds.Tables["abc"].Columns["Name"].MaxLength;
      

  2.   

    芝麻兄的办法很对.你可以参考啊.
    textBox1.DataBindings.Add("Text",ds.Tables["abc"],"Name");
    textBox1.MaxLength=ds.Tables["abc"].Columns["Name"].MaxLength;