感谢甜版,确实是路径错了另外下面这样,也可以快速读取外部表了Dim cmd As New SQLCommand
cmd.C
cmd.CommandText = "s elect style_id from s_style where style_id like '%19s%' and image_1 is not null"
Dim dt As DataTable = cmd.ExecuteReader
If dt.DataRows.Count > 0 Then
For Each dr As DataRow In dt.DataRows
Dim src As String
src = "c:\desk\img1\" + dr("style_id") + ".jpg" '文件路径一定要存在
Dim cmd1 As New SQLCommand
cmd1.C
cmd1.CommandText = CExp("s elect image_1 as img1 from s_style where style_id='{0}'", dr("style_id"))
Dim dt1 As DataTable = cmd1.ExecuteReader
Dim dr1 As DataRow = dt1.DataRows(0)
Dim imagebytes As Byte() = dr1("img1")
Using stream As System.IO.Stream = New System.IO.MemoryStream(imagebytes)
Dim bmp As System.Drawing.Bitmap = New System.Drawing.Bitmap(stream)
bmp.save(src)
bmp.Dispose
stream.Close
stream.Dispose
End Using
Next
End If