How do you insert a file (PDF) into a varbinary SQL Server column and then extract it?

I search for the report results (PDF file from Crystal Reports), serialize it, insert it into the varbinary field, and then get the opportunity to deserialize it and present it to the user.

For now, I just need to install the old ADO.NET (SqlClient, SqlCommand, etc.)

Are there any pitfalls? What is the main syntax for this, given the fact that I know the path on the local computer where the PDF file is currently saved?

+5
source share
2 answers

: MSDN, . VARBINARY (MAX). (, ).

MY OLD ANSWER: VARBINARY 8 . PDF . IMAGE.

/ SqlCommand, SQL, .

, , .

2: #, DataReader. DataReader, SequentialAccess SqlCommand.ExecuteReader, .

+5

byte[] IDbCommand . , PDF 100 ? , , 100 ( ) . PDF ... ... .

, , "Blob + Stream = BlobStream" , , .NET . SQL Server BLOB Stream.

, , , . , , , CodeProject, , image SQL Server. .

, .

+3

All Articles