TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
OJT Department
NA
1
649
PDF file that is retrieved from database is incorrect
Jan 25 2016 10:40 PM
Good day guys hope you will help me on this,
Lately I am saving pdf files in MySQL database into BLOB Datatypes. Few days later
I discover how to retrieve the PDF Files that I saved from the database. But there is a problem,
When I open the pdf file that I retrieve. Error message shows that is in incorrect format and
it's not a pdf file. Below is my code for retrieving PDF File:
DataTable table = part.GetPartAttachment();
byte[] filedata = (byte[])table.Rows[0][0];
SaveFileDialog sfd = new SaveFileDialog();
string filetosave;
sfd.Filter = "(*.pdf)|*.pdf";
if (sfd.ShowDialog() != DialogResult.Cancel)
{
filetosave = sfd.FileName;
FileStream fs = new FileStream(filetosave,
FileMode.Create,FileAccess.
Write);
BinaryWriter bw = new BinaryWriter(fs);
bw.Write(filedata);
bw.Close();
}
Hope you'll help me on this masters
Reply
Answers (
1
)
C# STORING ARRAY into SQLITE
how to bind data from selected months in c# windows app?