Private Sub PAPHOTO_SEL()
Try
Dim objCon As SqlConnection
Dim objCmd As SqlCommand
'打开数据库
objCon = New SqlConnection(PA001H_INSERT.strConn)
objCon.Open()
'定义SQL字符串
Dim SQL_String As String
SQL_String = "select top 1 pa_photo from LJPA005H WHERE pa_no='" & Me.TB_PANO.Text & "' order by uid desc"
'执行操作
objCmd = New SqlCommand(SQL_String, objCon)
'objCmd.CommandTimeout = dbTimeout
objCmd.ExecuteNonQuery()
Dim DataRd As SqlDataReader = objCmd.ExecuteReader
If DataRd.Read Then
Dim da() As Byte
da = DataRd("pa_photo")
Me.PB_PAPHOTO.Image = Bitmap.FromStream(New IO.MemoryStream(da))
Else
'Me.TxtPictureURL.Text = "数据库中没有图片!"
Me.PB_PAPHOTO.Image = Global.LJPA001H.My.Resources.Resources.noimage
End If
DataRd.Close()
objCon.Close()
Catch ex As Exception
MessageBox.Show(Err.Description)
End Try
End Sub