zoukankan      html  css  js  c++  java
  • Ibatis 返回datatable数据类型案例

    /// <summary>
    /// 查询实体 [DataSet数据集]
    /// </summary>
    /// <param name="statementName">原命令名称</param>
    /// <param name="paramObject">参数</param>
    /// <returns>DataSet数据集</returns>
    public virtual DataSet GetDataSetProce(string statementName, object paramObject)
    {
    ISqlMapper sqlMapper = MapperFactory.Get();
    ISqlMapSession sqlMapSession = GetMapSession(sqlMapper);
    IMappedStatement mappedStatement = sqlMapper.GetMappedStatement(statementName);
    RequestScope requestScope = mappedStatement.Statement.Sql.GetRequestScope(mappedStatement, paramObject, sqlMapSession);
    mappedStatement.PreparedCommand.Create(requestScope, sqlMapSession, mappedStatement.Statement, paramObject);
    IDbCommand dbCommand = sqlMapSession.CreateCommand(CommandType.StoredProcedure);
    IDbCommand interfaceCmd = requestScope.IDbCommand;
    dbCommand.CommandTimeout = 0;
    dbCommand.CommandText = interfaceCmd.CommandText;
    foreach (IDataParameter dataParameter in interfaceCmd.Parameters)
    {
    IDataParameter sqlParam = new SqlParameter();
    sqlParam.ParameterName = dataParameter.ParameterName;
    sqlParam.Value = dataParameter.Value;
    sqlParam.DbType = dataParameter.DbType;
    dbCommand.Parameters.Add(sqlParam);
    }
    dbCommand.Connection = sqlMapSession.Connection;
    interfaceCmd.Connection = sqlMapSession.Connection;
    var dbDataAdapter = sqlMapSession.CreateDataAdapter(dbCommand);
    var ds = new DataSet();
    dbDataAdapter.Fill(ds);
    return ds;
    }

  • 相关阅读:
    python 安装预编译库注意事项-pip
    Lucene 入门需要了解的东西
    PHPSTORM 与 Xdebug 配合调试
    Windows 下命令行修改文件夹的控制权限 Cacls
    PHP 解压zip文件的函数封装
    PHP 关于回调的用法
    CentOS7 安装 swoole
    CentOS7 安装 scala 2.11.1
    PHP 代码质量检测工具的安装与使用
    PHP 新建动态类的代码
  • 原文地址:https://www.cnblogs.com/guozefeng/p/3620651.html
Copyright © 2011-2022 走看看