Display s From Database _ DaniWeb

download Display s From Database _ DaniWeb

of 4

Transcript of Display s From Database _ DaniWeb

  • 7/28/2019 Display PDF Files From Database _ DaniWeb

    1/4

    Recently Updated Articles Join the DaniWeb Community Ad: 5-Star Stock Pick: CTLE

    http://links.industrybrains.com/click?sid=741&rqctid=5420&pos=1&lid=730243&cid=157406&pr=2&tstamp=20130710080720&ltype=NA&lname=&url=http://www.theamericansignal.nethttp://www.daniweb.com/members/joinhttp://www.daniweb.com/articles/latest
  • 7/28/2019 Display PDF Files From Database _ DaniWeb

    2/4

  • 7/28/2019 Display PDF Files From Database _ DaniWeb

    3/4

    7/15/13 display pdf files from database | DaniWeb

    www.daniweb.com/software-development/vbnet/threads/240232/display-pdf- fi les- from-database 3/4

    Software Development > VB.NET

    TweetTweet

    View similar articles that have also been tagged: binarypdf

    adding ajax array asp.net binary browser-$filename bst bug convert cost create cyberwar data decimal delphi display elements error file fileoutputstream flipping_book hack hexadecimal

    hidden html huffman in india int java java scrip t jsp key language machine menu mock mysql news page pakistan pascal pdf pep8 php phpunit ppt python random randomaccessfile

    reading scribus search security sla store string structure text tree upload validation web

    2013 DaniWeb LLC

    Page generated in 0.0593 seconds using 2.69MB

    22.

    23. PrivateSub ButtonDownload_Click(ByVal sender As System.Object,ByVal e As System.EventArgs)

    Handles ButtonDownload.Click

    24. Dim sFilePath AsString

    25. Dim buffer AsByte()

    26. Using conn AsNew SqlConnection("Data Source=apex2006sql;Initial Catalog=Scott;Integrated

    Security=True;")

    27. conn.Open()

    28. Using cmd AsNew SqlCommand("Select Top 1 PDF From PDF", conn)

    29. buffer = cmd.ExecuteScalar()

    30. End Using

    31. conn.Close()

    32. End Using

    33. sFilePath = System.IO.Path.GetTempFileName()

    34. System.IO.File.Move(sFilePath, System.IO.Path.ChangeExtension(sFilePath,".pdf"))

    35. sFilePath = System.IO.Path.ChangeExtension(sFilePath,".pdf")

    36. System.IO.File.WriteAllBytes(sFilePath, buffer)

    37. Dim act As Action(Of String)=New Action(Of String)(AddressOf OpenPDFFile)

    38. act.BeginInvoke(sFilePath,Nothing,Nothing)

    39. EndSub

    40.

    41. PrivateSharedSub OpenPDFFile(ByVal sFilePath)

    42. Using p AsNew System.Diagnostics.Process

    43. p.StartInfo =New System.Diagnostics.ProcessStartInfo(sFilePath)

    44. p.Start()

    45. p.WaitForExit()

    46. Try

    47. System.IO.File.Delete(sFilePath)

    48. Catch

    49. EndTry

    50. End Using

    51. EndSub

    52. EndClass

    The OpenPDF method is launched in another thread so it can wait for the process to terminate then clean up the temporary PDF file

    written to disk.

    Markdown Syntax: Formatting Help

    Bold Italic Code Inline Code Link Quote Heading Sub-Heading # List List Undo Redo Preview

    This article has been dead for over three months: Start a new discussion instead

    Post:

    Reply to this Discussion (Alt+S)

    You

    ShareShare

    http://www.daniweb.com/community/contribute/58http://www.daniweb.com/community/syntaxhttp://www.daniweb.com/tags/webhttp://www.daniweb.com/tags/validationhttp://www.daniweb.com/tags/uploadhttp://www.daniweb.com/tags/treehttp://www.daniweb.com/tags/texthttp://www.daniweb.com/tags/structurehttp://www.daniweb.com/tags/stringhttp://www.daniweb.com/tags/storehttp://www.daniweb.com/tags/slahttp://www.daniweb.com/tags/securityhttp://www.daniweb.com/tags/searchhttp://www.daniweb.com/tags/scribushttp://www.daniweb.com/tags/readinghttp://www.daniweb.com/tags/randomaccessfilehttp://www.daniweb.com/tags/randomhttp://www.daniweb.com/tags/pythonhttp://www.daniweb.com/tags/ppthttp://www.daniweb.com/tags/phpunithttp://www.daniweb.com/tags/phphttp://www.daniweb.com/tags/pep8http://www.daniweb.com/tags/pdfhttp://www.daniweb.com/tags/pascalhttp://www.daniweb.com/tags/pakistanhttp://www.daniweb.com/tags/pagehttp://www.daniweb.com/tags/newshttp://www.daniweb.com/tags/mysqlhttp://www.daniweb.com/tags/mockhttp://www.daniweb.com/tags/menuhttp://www.daniweb.com/tags/machinehttp://www.daniweb.com/tags/languagehttp://www.daniweb.com/tags/keyhttp://www.daniweb.com/tags/jsphttp://www.daniweb.com/tags/javascripthttp://www.daniweb.com/tags/javahttp://www.daniweb.com/tags/inthttp://www.daniweb.com/tags/indiahttp://www.daniweb.com/tags/inhttp://www.daniweb.com/tags/huffmanhttp://www.daniweb.com/tags/htmlhttp://www.daniweb.com/tags/hiddenhttp://www.daniweb.com/tags/hexadecimalhttp://www.daniweb.com/tags/hackhttp://www.daniweb.com/tags/flipping_bookhttp://www.daniweb.com/tags/fileoutputstreamhttp://www.daniweb.com/tags/filehttp://www.daniweb.com/tags/errorhttp://www.daniweb.com/tags/elementshttp://www.daniweb.com/tags/displayhttp://www.daniweb.com/tags/delphihttp://www.daniweb.com/tags/decimalhttp://www.daniweb.com/tags/datahttp://www.daniweb.com/tags/cyberwarhttp://www.daniweb.com/tags/createhttp://www.daniweb.com/tags/costhttp://www.daniweb.com/tags/converthttp://www.daniweb.com/tags/bughttp://www.daniweb.com/tags/bsthttp://www.daniweb.com/tags/browser-%24filenamehttp://www.daniweb.com/tags/binaryhttp://www.daniweb.com/tags/asp.nethttp://www.daniweb.com/tags/arrayhttp://www.daniweb.com/tags/ajaxhttp://www.daniweb.com/tags/addinghttp://www.daniweb.com/tags/pdfhttp://www.daniweb.com/tags/binaryhttp://www.daniweb.com/rss/pull/58https://twitter.com/intent/tweet?hashtags=VB.NET&original_referer=http%3A%2F%2Fwww.daniweb.com%2Fsoftware-development%2Fvbnet%2Fthreads%2F240232%2Fdisplay-pdf-files-from-database&related=DaniWeb&text=display%20pdf%20files%20from%20database%20%7C%20DaniWeb&tw_p=tweetbutton&url=http%3A%2F%2Fwww.daniweb.com%2Fsoftware-development%2Fvbnet%2Fthreads%2F240232%2Fdisplay-pdf-files-from-database&via=DaniWebhttp://www.daniweb.com/software-development/vbnet/58http://www.daniweb.com/software-development/2
  • 7/28/2019 Display PDF Files From Database _ DaniWeb

    4/4