zoukankan      html  css  js  c++  java
  • 3 获取对象IDbDataParameter; IDbCommand参数信息的导出

    //oracle版
    new OracleParameter();
      
    //SqlServer版
    new SqlDataParameter();
      
    //OleDb版
    new OleDbParameter();
      
    //Odbc版
    new OdbcParameter();
    

      

       //IDbCommand引用存储过程的参数信息的导出。得到的参数添加到IDbCommand参数集合
        public void DeriverParameters(IDbCommand cmd)
            {
                bool mustCloseConnection = false;
                if (!(cmd is OracleCommand)) 
                {
                    //在向方法提供的其中一个参数无效时引发的异常。
                    throw new ArgumentException("The command provided is not an OracleCommand instance", "cmd");
                }
                if (cmd.Connection.State != ConnectionState.Open) 
                {
                    cmd.Connection.Open();
                    mustCloseConnection = true;
                }
                //从在 OracleCommand 中指定的存储过程中检索参数信息并填充指定的 OracleCommand.Parameters 集合
                OracleCommandBuilder.DeriveParameters((OracleCommand)cmd);
    
                if (mustCloseConnection) 
                {
                    //关闭连接
                    cmd.Connection.Close();
                }
            }
    

      

  • 相关阅读:
    python基础练习5-9
    python安装
    python虚拟环境
    python基础语法--逻辑实现
    python基础语法
    IDE(vscode)
    pycharm使用
    复习
    环境搭建+python基础
    ASP.NET 5行代码搞二维码
  • 原文地址:https://www.cnblogs.com/shenshiting/p/7743615.html
Copyright © 2011-2022 走看看