I am working on a database project using C # and SQLServer 2012. In one of my forms, I have a PDF file with other information that is stored in a table. This works successfully, but when I want to get the saved information, I had a problem displaying the PDF file, because I canโt display it, and I donโt know how to display it.
I read several articles that say that it cannot be displayed using the Adobe PDF viewer from the memory stream, is there any way?
This is my code to retrieve data from a database:
sql_com.CommandText = "select * from incoming_boks_tbl where [incoming_bok_id]=@incoming_id and [incoming_date]=@incoming_date";
sql_com.Parameters.AddWithValue("incoming_id",up_inco_num_txt.Text);
sql_com.Parameters.AddWithValue("incoming_date", up_inco_date_txt.Text);
sql_dr = sql_com.ExecuteReader();
if(sql_dr.HasRows)
{
while(sql_dr.Read())
{
up_incoming_id_txt.Text = sql_dr[0].ToString();
up_inco_num_txt.Text = sql_dr[1].ToString();
up_inco_date_txt.Text = sql_dr[2].ToString();
up_inco_reg_txt.Text = sql_dr[3].ToString();
up_inco_place_txt.Text = sql_dr[4].ToString();
up_in_out_txt.Text = sql_dr[5].ToString();
up_subj_txt.Text = sql_dr[6].ToString();
up_note_txt.Text = sql_dr[7].ToString();
string file_ext = sql_dr[8].ToString();
byte[] inco_file = (byte[])(sql_dr[9]);
MemoryStream ms = new MemoryStream(inco_file);
}
}
source
share