[求助]关于数据绑定问题
woyao数据库里有一个表table1,字段name下有两个姓名“maomao”和“maochong”,name字段和TextBox控件绑定后能显示maomao,
要是我想让控件显示name列下的第2个值maochong,代码应该怎么写?
class jincheng:Form{
TextBox lv1=new TextBox();
public jincheng(){
OleDbConnection obc1=new OleDbConnection("Provider=SQLOLEDB.1;User ID=sa;Initial Catalog=woyao;Data Source=LIL");
obc1.Open();
DataSet ds1=new DataSet();
OleDbDataAdapter obcm=new OleDbDataAdapter("select * from Table1",obc1);
obcm.Fill(ds1,"Table1");
lv1.DataBindings.Add("Text",ds1,"Table1.name");
obc1.Close();
Controls.Add(lv1);
}
[此贴子已经被作者于2007-3-24 3:18:35编辑过]