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

  • 相关阅读:
    生成函数
    LOJ6078 「2017 山东一轮集训 Day7」重排
    Gym101981C Cherry and Chocolate
    Gym102411C Cross-Stitch
    使用filter对请求设置编码
    java过滤器filter使用
    java操作数据库的事务支持
    jsp泛型支持
    jstl 使用
    jsp el的内置对象
  • 原文地址:https://www.cnblogs.com/guozefeng/p/3620651.html
Copyright © 2011-2022 走看看