I really wouldn't use a byte[]
parameter to an IDbCommand
at all. What if your PDF is 100 Mb big? As far as I know, this would get all those 100 Mb from your database (needing that amount of memory on your server) before sending the result to the requesting browser. Now think about getting a number of concurrent request for different PDFs of roughly this size... per second... That is not very scalable.
For a possible solution, please check out "Blob + Stream = BlobStream", an article I wrote for the .NET Magazine here in the Netherlands a couple of years ago. This method uses SQL Server commands to access parts of a BLOB from a Stream
derived class.
The article is in Dutch, but the example code that goes with it should be enough to get you started. Also, Peter De Jonghe seems to have written an article on CodeProject that expands on my article a bit, generalizing it to more than just image
columns in SQL Server. This article is in English.
I hope this helps you with your problem.