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
Goran Bibic
484
2.9k
196.8k
Read PDF file from sql to AxAcroPDF c#
Jul 31 2018 4:37 AM
Some help?
I try this but dont work, no have errors but not read file...please help
{
if
(documentsDataGridView.SelectedRows.Count > 0)
{
string id = documentsDataGridView.SelectedRows[0].Cells[
"dataGridViewTextBoxColumn1"
].Value.ToString();
string number = documentsDataGridView.SelectedRows[0].Cells[
"dataGridViewTextBoxColumn2"
].Value.ToString();
string count_number = documentsDataGridView.SelectedRows[0].Cells[
"dataGridViewTextBoxColumn3"
].Value.ToString();
string label = documentsDataGridView.SelectedRows[0].Cells[
"dataGridViewTextBoxColumn4"
].Value.ToString();
string partner = documentsDataGridView.SelectedRows[0].Cells[
"dataGridViewTextBoxColumn5"
].Value.ToString();
string tax_number = documentsDataGridView.SelectedRows[0].Cells[
"dataGridViewTextBoxColumn6"
].Value.ToString();
string file_location = documentsDataGridView.SelectedRows[0].Cells[
"file_location"
].Value.ToString();
//string pdf_file = documentsDataGridView.SelectedRows[0].Cells["pdf_file"].Value.ToString();
idTextBox.Text = id;
numberTextBox.Text = number;
count_numberTextBox.Text = count_number;
labelTextBox.Text = label;
partnerComboBox.Text = partner;
tax_numberTextBox.Text = tax_number;
dateDateTimePicker.Value = Convert.ToDateTime(documentsDataGridView.SelectedRows[0].Cells[
"dataGridViewTextBoxColumn7"
].Value);
file_locationTextBox.Text = file_location;
//axAcroPDF1.src = pdf_file;
try
{
if
(documentsDataGridView.SelectedRows[0].Cells[
"pdf_file"
].Value != null)
{
byte[] ap = (byte[])(documentsDataGridView.SelectedRows[0].Cells[
"pdf_file"
].Value);
MemoryStream ms =
new
MemoryStream(ap);
axAcroPDF1.src = LocalEncoding.GetString(ms.ToArray());
//axAcroPDF1.LoadFile(ms);
}
else
{
axAcroPDF1.src = null;
}
}
catch
{
axAcroPDF1.src = null;
}
}
}
Reply
Answers (
5
)
Retrieve pdf file from sql c#
Asp.Net Core 2.0 & Angular 4