public DataTable ExecuteDataTable(Sql sql)
{
return ExecuteDataTable(sql.SQL, sql.Arguments);
}
public DataTable ExecuteDataTable(string sql, params object[] args)
{
try
{
OpenSharedConnection();
try
{
using (var cmd = CreateCommand(_sharedConnection, sql, args))
{
var val = cmd.ExecuteReader();
OnExecutedCommand(cmd);
var dt = new DataTable();
dt.Load(val);
return dt; //(T)Convert.ChangeType(val, typeof(T));
}
}
finally
{
CloseSharedConnection();
}
}
catch (Exception x)
{
OnException(x);
throw;
}
}