如何检索保存在MySQL数据库中的文件?

时间:2017-06-11 06:07:20

标签: mysql vb.net

这是我目前的代码:

MySqlConnection.Open()
command.Connection = MySqlConnection
command.CommandText = "select * from add_document"

READER = command.ExecuteReader
READER.Read()

Dim filebytes() As Byte = CType(READER(1), Byte())

Dim FStream As New FileStream(READER(0).ToString, FileMode.Create, FileAccess.Write)
FStream.Write(filebytes, 0, filebytes.Length)
FStream.Close()

MessageBox.Show("File Retrieved")

我收到以下异常:

  

无法将类型为system.string'的对象强制转换为'system.byte []

0 个答案:

没有答案