Dim con As New SqlConnection
Dim cmd As New SqlCommand
Dim str As String
Dim dr As SqlDataReader
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
str = "select * from llr where llrno='" & TextBox1.Text & "'"
cmd = New SqlCommand(str, con)
con.Open()
dr = cmd.ExecuteReader()
If dr.HasRows Then
dr.Read()
Dim img As Byte() = DirectCast(dr("img"), Byte())
Dim ms As New MemoryStream(img)
PictureBox1.Image = Image.FromStream(ms)
End If
dr.Close()
cmd.Dispose()
con.Close()
End Sub
質問する
2635 次