Question

I am trying to understand how to correctly load a large file into a database. I understand how to get the file from the database and stream it back without using too many resources by using a DataReader to read into a buffer and then writing the buffer to the OutputStream.

When it comes to storing the file all of the examples I could find read then entire file into a byte array and then supply it to a data parameter.

Is there a way to store the file into a database without having to read then entire file into memory first?

I am using ASP.NET and Sql Server

Was it helpful?

Solution

If you can use .Net 4.5, there is new support for streaming. Also, see Using ADO's new Async methods which gives some complimentary examples.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top