0

well in a database is saved a binary code (this is a *.jar) i need to download this code (with a select query) and Rebuild this file

What are the setps for convert since a String to a File?

someone told me i need convert it to array byte, but i dont know how to convert a String to a array byte... what are the best steps?

this code return me a table

Public Function ConseguirCatalogo() As DataTable


        Return conn.RegresarTabla("select archivo from catalogo where id= (select id from periodos where actual=1)")

    End Function

and this code i get the String

Private Sub EnviarArchivo() 'para el catalogo

Dim MyTable As DataTable = consultas.ConseguirCatalogo()
Dim binarycode As String = MyTable.Rows(0)(0).ToString()

End Sub

now what are the next setp for convert it finally to a file? ( it is a *.jar)

1 Answer 1

1

When you have converted the data into a string, it's already ruined. You should get the data as a byte array directly:

Dim binarycode As Byte() = DirectCast(MyTable.Rows(0)(0), Byte())
Sign up to request clarification or add additional context in comments.

4 Comments

and now i have BinaryCode as Byte how do i convert it to a file? @Guffa
I get a bug doing it "Dim binarycode As Byte() = DirectCast(MyTable.Rows(0)(0), Byte())"... String can't convert to '1-matriz' dimensional byte @Guffa
Then it's not really binary in the database, or your RegresarTabla doesn't read it correctly into the data table.
no, bug is a String can't convert to a byte array its a sintaxis error

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.