zoukankan      html  css  js  c++  java
  • BindingSoure和BindingNavigator 用法实例

     private BindingSource myBindingSource = new BindingSource();
            OracleConnection conn = new OracleConnection("Data Source=xxx;Persist Security Info=True;User ID=xxx;Password=xxx");

            private void Form1_Load(object sender, EventArgs e)
            {
              
                string sql3 = "select * from xxxx ";
                OracleCommand cmd3 = new OracleCommand(sql3, conn);
                OracleDataAdapter oda = new OracleDataAdapter(cmd3);
                DataSet ds = new DataSet();
                oda.Fill(ds);
                myBindingSource.DataSource = ds.Tables[0];              //绑定数据源
                this.bindingNavigator1.BindingSource = myBindingSource; //数据源跟bindingNavigator1控件相连

                this.dataGridView1.DataSource = myBindingSource;        //数据源跟dataGridView1控件相连


                this.textBox1.DataBindings.Add("Text", myBindingSource, "IP");//数据源跟textBox1控件相连


            }

            private void button1_Click(object sender, EventArgs e)
            {
                myBindingSource.MoveNext();
            }

            private void button2_Click(object sender, EventArgs e)
            {
                myBindingSource.MovePrevious();
            }

  • 相关阅读:
    Thinkphp 获取当前url
    Navicat Premium 11 For Mac 注册机
    android 客户端支付宝 php服务器端编写
    tp框架集成支付宝,中转页变成gbk编码
    sql,插入最大值加1
    获取php的配置
    百度授权回调问题
    模拟新浪微博textarea,刷新页面输入信息保留
    同一客户端使用多份SSH Key
    SSH 自动化安装部署遇到的问题
  • 原文地址:https://www.cnblogs.com/timy/p/1424104.html
Copyright © 2011-2022 走看看