| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 420 人关注过本帖
标题:[求助]关于控件绑定问题
只看楼主 加入收藏
sun_life
Rank: 1
等 级:新手上路
帖 子:356
专家分:5
注 册:2006-5-29
结帖率:72.73%
收藏
 问题点数:0 回复次数:0 
[求助]关于控件绑定问题
string str_select = "select 专业ID=tb_SpecialtyInfo.t_specialtyID,专业名=tb_SpecialtyInfo.t_specialtyName,学习年制=tb_SpecialtyInfo.t_Year,院系名=tb_CollegeInfo.t_CollegeName,说明=tb_SpecialtyInfo.t_caption from tb_SpecialtyInfo,tb_CollegeInfo where tb_SpecialtyInfo.t_CollegeID=tb_CollegeInfo.t_CollegeID";
string connString = ConfigurationManager.ConnectionStrings["connString"].ConnectionString;

            SqlConnection conn = new SqlConnection(connString);

            DataSet ds = new DataSet();

            SqlDataAdapter da,da2;

            da = new SqlDataAdapter(str_select ,conn);

            da2 = new SqlDataAdapter("select  t_CollegeName from tb_CollegeInfo",conn);  //连接院系信息表

            da.Fill(ds, "tb_SpecialtyInfo,tb_CollegeInfo");

            da2.Fill(ds, "tb_CollegeInfo");

            cBox_specialtyCD.DataSource = ds;   //绑定tb_CollegeInfo表中的院系名字段

            cBox_specialtyCD.DisplayMember = "tb_CollegeInfo.t_CollegeName";

            Binding Bd_ID = new Binding("Text", ds, "tb_SpecialtyInfo.专业ID");      //绑定专业ID

            this.txt_specialtyID.DataBindings.Clear();      //清除绑定信息

            this.txt_specialtyID.DataBindings.Add(Bd_ID);

            //Binding Bd_SName = new Binding("Text", ds, "tb_SpecialtyInfo.专业名");       //绑定专业名

            //this.txt_specialtyName.DataBindings.Clear();

            //this.txt_specialtyName.DataBindings.Add(Bd_SName);

            //Binding Bd_NZ = new Binding("Text", ds, "tb_SpecialtyInfo.学习年制");      //绑定年制

            //this.cBox_NZ.DataBindings.Clear();

            //this.cBox_NZ.DataBindings.Add(Bd_NZ);

            ////Binding Bd_College = new Binding("Text", ds, "tb_SpecialtyInfo.院系名");         //绑定院系名

            ////this.cBox_specialtyCD.DataBindings.Clear();

            ////this.cBox_specialtyCD.DataBindings.Add(Bd_College);

            //Binding Bd_caption = new Binding("Text", ds, "tb_SpecialtyInfo.说明");     //绑定说明

            //this.txt_caption.DataBindings.Clear();

            //this.txt_caption.DataBindings.Add(Bd_caption);

            this.dGridV_specialty.DataSource = ds;

            this.dGridV_specialty.DataMember = "tb_SpecialtyInfo,tb_CollegeInfo";      //绑定dGridV_specialty控件

            MyBm = this.dGridV_specialty.BindingContext[ds, "tb_SpecialtyInfo,tb_CollegeInfo"];


提示这句话错误: Binding Bd_ID = new Binding("Text", ds, "tb_SpecialtyInfo.专业ID");      //绑定专业ID

错误提示:无法创建字段 tb_SpecialtyInfo 的子列表
搜索更多相关主题的帖子: 绑定 控件 
2008-11-10 13:10
快速回复:[求助]关于控件绑定问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.030418 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved