Insert into
byte[] filedata = null;
MemoryStream ms = new MemoryStream();
filedata = ms.GetBuffer();
axAcroPDF1.src = LocalEncoding.GetString(ms.ToArray());
querySaveStaff.Parameters.AddWithValue("@pdf_file", SqlDbType.VarBinary).Value = filedata;
I need to retrieve PDF files from sql database
I try this
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;
}