| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1031 人关注过本帖
标题:mybind.Position = mybind.Position + 1 是不是一定要用在强类型dataset上
只看楼主 加入收藏
zhengyingcan
Rank: 1
等 级:新手上路
帖 子:412
专家分:6
注 册:2007-10-16
结帖率:89.81%
收藏
已结贴  问题点数:20 回复次数:3 
mybind.Position = mybind.Position + 1 是不是一定要用在强类型dataset上
我看见一列子是用 position来移动数据指针,但是dataset是强类型的,但是我的不是强类型,我编码代码如下
public partial class 博禄德电子销售计划通知单 : Form
    {
        DataSet ds = new DataSet();
        string strcnna = gongyong.strcn3;
        BindingManagerBase mybind;  //抽象类,管理绑定到相同的数据源,的数据成员的所有
        public 博禄德电子销售计划通知单()
        {
            InitializeComponent();            
        }

      
        private void chazhao_Click(object sender, EventArgs e)
        {
            string strwhere = "";
            if (!string.IsNullOrEmpty(订单号.Text))
                strwhere += "csocode like '%" + 订单号.Text + "%' and ";
            if (!string.IsNullOrEmpty(合同号.Text))
                strwhere += "cdefine2 like '%" + 合同号.Text + "%' and ";
                      if (strwhere!="")            {
                string zbmc = "主表";
                strwhere = strwhere.Substring(0, strwhere.Length - 5);
                string stemp = "select csocode as 订单号,ddate as 订单日期,ccusname as 客户简称,cdefine2 as 合同号,"
                            + "cmemo as 备注1,cdefine12 as 备注2,cverifier as 审核人 from so_somain where  " + strwhere;
                linkdatabase link = new linkdatabase();  //自定义类,生成ds
                ds.Clear();  //先清除掉再重新获得
                ds = link.selectdataset2(strcnna, stemp,zbmc);//获得ds
              mybind = BindingContext[ds, "主表"]; //进行绑定
                //以下要开始绑定动作
                Binding binda = new Binding("text", ds.Tables["主表"], "订单号", true);
                Binding bindb = new Binding("text", ds.Tables["主表"], "订单日期", true);
                Binding bindc = new Binding("text", ds.Tables["主表"], "客户简称", true);
                Binding bindd = new Binding("text", ds.Tables["主表"], "合同号", true);
                Binding binde = new Binding("text", ds.Tables["主表"], "备注1", true);
                Binding bindf = new Binding("text", ds.Tables["主表"], "备注2", true);
                Binding bindg = new Binding("text", ds.Tables["主表"], "审核人", true);
                //先清除掉之前所有绑定
                gongyong.qinbinging(this);
                //再进行绑定
                订单号.DataBindings.Add(binda);
                订单日期.DataBindings.Add(bindb);
                客户简称.DataBindings.Add(bindc);
                合同号.DataBindings.Add(bindd);
                备注A.DataBindings.Add(binde);
                备注2.DataBindings.Add(bindf);
                审核人.DataBindings.Add(bindg);
            }
        }

      private void moveright_Click(object sender, EventArgs e)
        {
            mybind.Position = mybind.Position + 1;         
        }代码没有报错,只是用moveright移动指针,文本框上的数据没有变.
搜索更多相关主题的帖子: mybind 类型 dataset Position 
2009-06-26 09:52
yangglemu
Rank: 7Rank: 7Rank: 7
等 级:黑侠
帖 子:273
专家分:521
注 册:2006-9-15
收藏
得分:2 
我从来不用Bind之类的东东

试着挣个威望!
2009-06-26 09:56
guang
Rank: 4
来 自:广东深圳
等 级:贵宾
威 望:13
帖 子:1414
专家分:285
注 册:2006-4-3
收藏
得分:18 
没用过BindingManagerBase
你换成BindingSource试下

不相信未作牺牲竟先可拥有,只相信靠双手找到我的欲求!!
我的博客:http://liao5930.blog.
2009-06-26 10:04
快速回复:mybind.Position = mybind.Position + 1 是不是一定要用在强类型datas ...
数据加载中...
 
   



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

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