Hi friends,
What is the procedure to store pdf file in SqlServer? Explain it?
PDF File In SQLSERVER
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Javeed M ShaikhRank #839 · 2.7K reputationPosted Oct 20, 2011, 5:47 PM EDT
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".