标题:mybind.Position = mybind.Position + 1 是不是一定要用在强类型dataset上
取消只看楼主
zhengyingcan
Rank: 1
等 级:新手上路
帖 子:412
专家分:6
注 册:2007-10-16
结帖率:89.81%
已结贴  问题点数:20 回复次数:0 
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



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-277399-1-1.html




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

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