تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
أين الخطأ في طريقة عرض الصورة من قاعدة البيانات sql ؟
#9
كود :
بناء على الإجراء المخزن المكتوب

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()
الرد }}}
تم الشكر بواسطة:


الردود في هذا الموضوع
أين الخطأ في طريقة عرض الصورة من قاعدة البيانات sql ؟ - بواسطة حريف برمجة_mybb_import7120 - 16-04-13, 11:41 PM


التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم