我想在不确定特定路径的情况下使用writeAllBytes方法 因为我没有将pdf文件保存在电脑中。
我的尝试
<Button
android:id="@+id/imageButtonSelector"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/button_focused_orange"/>
我想要替换路径&#34; aaa.pdf&#34;直接使用pdfViewer1.FileName
答案 0 :(得分:0)
string pdfName = "C:\myPdfFiles\20170301\aaa.pdf";
string strSQL = "SELECT StorePDF FROM TB WHERE FileName='" + tbFilePath.Text + "'";
OleDbCommand cmd2 = new OleDbCommand(strSQL, conn);
cmd2.Connection = conn;
conn.Open();
Byte[] oleBytes = (Byte[])cmd2.ExecuteScalar();
File.WriteAllBytes(pdfName, oleBytes.Skip(0).ToArray());
pdfViewer1.FileName = pdfName;
?¡