none
code error: constant value cannot be converted to a byte RRS feed

  • Question

  • Trying to read a pdf file so it can be saved in a SQL Server database.

            Dim publickey As Object = Nothing
            Dim privatekey As Object = Nothing

            Dim Img As Byte = privatekey.ID.Concat(publickey.ID).ToArray()

            Dim strFile As String = "c:\temp\networksupplement.pdf"

            Img = File.ReadAllBytes(strFile)

    The last line ReadAllBytes(strFile) produces the above message.

    What am I doing wrong.  Thanks.


    ISV using VB.net and SQL Server Express

    Wednesday, February 28, 2018 6:31 PM

Answers

  • Another user, Viorel, provided the answer:

     Dim Img2 As Byte() = File.ReadAllBytes(strFile)

    Cannot find Viorel answer on forum only in an email to me.


       

    ISV using VB.net and SQL Server Express

    • Marked as answer by Jeff07 Wednesday, February 28, 2018 9:58 PM
    Wednesday, February 28, 2018 9:58 PM

All replies

  • Hi

    Your code doesn't make any sense to me.

    I suggest you put Option Strict On  and  Option Explicit On  at the top of your code.

    Talking of code, if you post code,please put it in a Code Block from the ToolBar of this edit pane.


    Regards Les, Livingston, Scotland

    Wednesday, February 28, 2018 7:28 PM
  • Another user, Viorel, provided the answer:

     Dim Img2 As Byte() = File.ReadAllBytes(strFile)

    Cannot find Viorel answer on forum only in an email to me.


       

    ISV using VB.net and SQL Server Express

    • Marked as answer by Jeff07 Wednesday, February 28, 2018 9:58 PM
    Wednesday, February 28, 2018 9:58 PM