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();
            }

  • 相关阅读:
    [HTML] IE=edge,chrome=1的META标签详解
    [FFmpeg] ffmpeg 常用命令
    rsyncd 配置使用
    httpd配置
    ftp利用脚本添加本地用户
    zabbix监控概念
    搭建本地yum源并定时同步
    linux添加lvm磁盘大小,命令行创建swap
    500 OOPS: vsftpd: refusing to run with writable root inside chroot()
    利用saltstack批量安装clamav杀毒软件
  • 原文地址:https://www.cnblogs.com/timy/p/1424104.html
Copyright © 2011-2022 走看看