كود :
بناء على الإجراء المخزن المكتوب
CREATE PROCEDURE pc_image
@ID_file int,@photo image
AS
begin
select ID_file,photo from full_data where ID_file = @ID_file
end
GO
هذا الكود
Dim com_image As New SqlCommand("pc_image", con2)
com_image.CommandType = CommandType.StoredProcedure
com_image.Parameters.AddWithValue("@ID_file", TextBox1.Text)
com_image.Parameters.Add("@Photo", SqlDbType.Image).Value = DBNull.Value
con2.Open()
Dim dr As SqlDataReader = com_image.ExecuteReader
If dr.Read = True Then
TextBox1.Text = dr!ID_file
Dim byimg() As Byte = dr!photo
Dim stimg As New System.IO.MemoryStream(byimg)
PictureBox1.Image = Image.FromStream(stimg)
Else
MsgBox("السجل غير موجود")
End If
dr.Close()
com_image.Dispose()
con2.Close()
