public static void QueryIntoDataSet(AbstractSqlConnectionDescriptor connDesc, string dataTableName, string sql,
IEnumerable sqlParams,
DataSet fillMe)
{
IDbConnection conn = DbCaches.Connections.Get(connDesc);
try
{
IDbCommand cmd = DbCaches.Commands.Get(sql, conn);
try
{
SetSQLOnCommand(connDesc, cmd, sql, sqlParams);
DbDataAdapter adapter = connDesc.CreateNewAdapter(cmd);
if (dataTableName != null)
{
adapter.Fill(fillMe, dataTableName);
}
else
{
adapter.Fill(fillMe);
}
}
catch (Exception e)
{
throw new UnableToRunSqlException("Unable to fill dataset with query: ",
connDesc, sql, sqlParams, e);
}
finally
{
DbCaches.Commands.Return(sql, conn, cmd);
}
}
finally
{
DbCaches.Connections.Return(connDesc, conn);
}
}