Dim cmd As new SQLCommand
cmd.ConnectionName = "test"
cmd.CommandText = "Insert Into test (文件) Values(?)"
Dim ImageByte() As Byte = System.IO.File.ReadAllBytes("D:\test.xls") '读取文件流,并将读到的二进制数据放入数组ImageByte中,
cmd.Parameters.Add("@文件", ImageByte)
cmd.ExecuteNonQuery
Dim cmd As new SQLCommand
cmd.ConnectionName = "T"
cmd.CommandText="select top 1 第八列 from DDDDD " '这里第八列是二进制列
Dim dt As DataTable = cmd.ExecuteReader
Dim imagebytes As Byte() = dt.DataRows(0)("第八列")
以下是引用有点蓝在2020/9/24 16:06:00的发言:
Dim cmd As new SQLCommand
cmd.ConnectionName = "T"
cmd.CommandText="select top 1 第八列 from DDDDD " '这里第八列是二进制列
Dim dt As DataTable = cmd.ExecuteReader
Dim imagebytes As Byte() = dt.DataRows(0)("第八列")
请教蓝版,上面代码得到二进制文件,下一步如何保存到本地呢?谢谢