public static DataSet ExecProcedureDataAsDataSet(string procedureName, object parameters = null)
{
using (var connection = new SqlConnection(SQLHelper.CONNECTION_STRINGS))
{
connection.Open();
var dataSet = new DataSet();
try
{
using (var reader = connection.ExecuteReader(procedureName, param: parameters, commandType: CommandType.StoredProcedure))
{
do
{
var dataTable = new DataTable();
dataTable.Load(reader);
dataSet.Tables.Add(dataTable);
} while (!reader.IsClosed);
}
}
catch (Exception ex)
{
Debug.WriteLine(ex.Message, "Error returned from Server: ");
}
return dataSet;
}
}