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

      

  • 相关阅读:
    js的元素对象
    js实现在末尾添加节点
    js实现点击增加文本输入框
    js的DOM对象
    js其它
    js实现99乘法表
    js
    http的六种请求方法
    11.进制
    10.Debug
  • 原文地址:https://www.cnblogs.com/shenshiting/p/7743615.html
Copyright © 2011-2022 走看看