Skip to content

Commit

Permalink
添加ExecuteReader方法
Browse files Browse the repository at this point in the history
  • Loading branch information
chi8708 committed Jan 11, 2019
1 parent e53d23e commit c54f21c
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions NBCZ.DBUtility/DbHelper/DapperHelper.cs
Expand Up @@ -30,6 +30,21 @@ public class DapperHelper

}

/// <summary>
///返回table数据
/// </summary>
/// <returns></returns>
public static DataTable ExecuteReaderToTable(string sql, object param = null, IDbTransaction transaction = null, int? commandTimeout = null, CommandType? commandType = null)
{
using (IDbConnection conn = new SqlConnection(connStr))
{
var reader = conn.ExecuteReader(sql, param, transaction, commandTimeout, commandType);
DataTable tb = new DataTable();
tb.Load(reader);
return tb;
}
}

/// <summary>
/// 查询返回list
/// </summary>
Expand Down

0 comments on commit c54f21c

Please sign in to comment.