Turing an Excel file streamed from an ASP web form into a DataSet on the server

I have built a web form in ASP.NET which uploads an Excel file to the server, and from there it's supposed to be transformed into a DataSet and the info dumped into the database.

However, I've got absolutely no idea how to turn a file stream into a DataSet, and I am loathed to actually copy the file onto the server and then use an ExcelConnection object, since uploading to the server has some security implications that I don't want to be responsible for.

So......

Can anyone help???

File Stream to DataSet???

I'd love to know!!!

Ged
gedmattAsked:
Who is Participating?
 
jj819430Connect With a Mentor Commented:
ADO.NET and OleDB would definitely need to grab the actual file. Converting the stream seems like a rediculously hard solution. (Though I wouldn't rule it impossible)

If these clients are say, your employees or co-workers, why not build an add-in for excel.

When they need to upload they just have to click a button. You can have it report to a simple webservice, and instead of burdening your server with any transformations, you can burden each of the PCs.

Now if it is the case that you want to regularly upload without user involvement, just create a little app that runs in the background. Same advantages as above, but no need to have the users click a button. (SO LONG AS THEY LEAVE THE PC ON) - I had a comical bug in something like this thanks to environmentally friendly personnel

Now if they are simply anonymous people, you may not want to force them to download anything to work with your application. In that case you can minimize security risks by setting things up correctly.
0
 
Bob LearnedConnect With a Mentor Commented:
Wow, I'd love to know, too :)  

There are methods for creating a DataSet from an XML file, but then you would have a similar problem with how to make the Excel file into an XML file.  

ADO.NET and the OleDb client needs a connection to a physical file to pull data into a dataset.

Bob
0
 
gedmattAuthor Commented:
Fair enough, it looks like I'll have to physically upload the file and make sure I've performed full authentication to prevent any mis-use...

Cheers,

Ged
0
All Courses

From novice to tech pro — start learning today.