Hi friends,
What is the procedure to store pdf file in SqlServer? Explain it?
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Javeed M ShaikhPosted Oct 20, 2011, 9:47 PM
You have to create the table with dataype "Image" and then while passing the data to the stored procedure you need to do the following:
cmd.Parameters.Add(new SqlParameter("@PDFData", "here you have to provide the byte array of pdf file"));
This is how you create the byte array:
byte[] bytes = System.IO.File.ReadAllBytes("myfile.pdf");
Please do not forget to mark "Accepted Answer".