I have produced a solution in a C# web app that runs a report which returns a DataSet containing 9 Datatables.
The tables are linked with many-to-many relationships, and the purpose of the report is to produce a snapshot of the progress on records contained in the tables for anyone point in time.
This dictates that all 9 tables are queried at once, as querying the tables individually at different times will mean that the results dont match up between tables.
I was returning the 9 csv files in a zip file, which worked fine in development. However, in the organisation I am working for a lot of user's machines are very limited and we cannot rely on them having winzip or some other archiving software, and as such I have been told to find an alternative solution.
So far, the problems I have come up against are:
All 9 datatables must be produced from the same query, which rules out giving users the option to run the report against tables individually as the results may not match up if they are run at different times of the day.
I can only return one file at a time to the browser, which stops me returning the collection of csv files unzipped.
I did think about returning the data as separate tabs on an excel workbook, however some of the results have leading zeros, which will be trimmed off when they are loading into the worksheet.
It would be great if anyone knew of an obvious solution I'm missing?
Using DotNetZip, you can zip and unzip files like so:
using Ionic.Zip;
namespace ConsoleApplication23
{
class Program
{
static void Main(string[] args)
{
//Zip your files like so
ZipFile x = new ZipFile();
x.AddFile(@"C:\myFile");
x.AddFile(@"C:\mySecondFile");
x.Save(@"c:\myZipFile.zip");
//Unzip like so
ZipFile y = ZipFile.Read(@"c:\myZipFile.zip");
foreach (ZipEntry e in y)
{
e.Extract(@"c:\test", ExtractExistingFileAction.OverwriteSilently);
}
}
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With