منتدى فيجوال بيسك لكل العرب | منتدى المبرمجين العرب

نسخة كاملة : حل مشكلة A generic error occurred in GDI+.
أنت حالياً تتصفح نسخة خفيفة من المنتدى . مشاهدة نسخة كاملة مع جميع الأشكال الجمالية .
السلام عليكم
عند حفظ صورة في بكتشر في الداتا تظهر هذه الرسالة
A generic error occurred in GDI+.

كود :
    Dim arrImage() As Byte
       Dim mstream As New System.IO.MemoryStream()
       PictureBox2.Image.Save(mstream, System.Drawing.Imaging.ImageFormat.Png)
       arrImage = mstream.GetBuffer()
       Dim FileSize As UInt32
       FileSize = mstream.Length
       mstream.Close()
cmd..Parameters.AddWithValue("@imgh", arrImage)
الرجاء المساعدة
هذا كود من احد مشاريع الاخ : حريف برمجة .

PHP كود :
   Private Sub Button9_Click(sender As ObjectAs EventArgsHandles Button9.Click
        
''حفظ الصورة في جدول الصور
        If TextBox2
.Text "" Then
            MsgBox
("قم بتحديد الأسم أولاً من اللست بوكس"64"حريف برمجة")
 
           TextBox2.Focus()
 
           Exit Sub
        End 
If
 
       If (PictureBox1.Image Is NothingThen
            MsgBox
("قم بإدراج الصورة أولاً"64"حريف برمجة")
 
           Exit Sub
        End 
If
 
       '''''''''التأكد من ان رقم السجل موجود في الجدول الأول قبل اضافة الصورة في الجدول الثاني'''''''''
 
       Dim Cmd As New OleDbCommand("select uid from tb1 where uid=@uid"conn)
 
       Cmd.Parameters.AddWithValue("@uid"TextBox1.Text)
 
       conn.Open()
 
       Dim dr As OleDbDataReader Cmd.ExecuteReader
        If dr
.Read False Then
            dr
.Close()
 
           Cmd.Dispose()
 
           conn.Close()
 
           MsgBox("رقم السجل غير موجود في الجدول الأول"64"حريف برمجة")
 
       Else
            Dim ms 
As New System.IO.MemoryStream
            PictureBox1
.Image.Save(msPictureBox1.Image.RawFormat)
 
           Dim picbyte() As Byte ms.GetBuffer
            Cmd 
= New OleDbCommand("insert into tb2 (puid,pphoto,pname) values (@puid,@pphoto,@pname)"conn)
 
           Cmd.Parameters.Clear()
 
           Cmd.Parameters.AddWithValue("@puid"TextBox1.Text)
 
           Cmd.Parameters.AddWithValue("@pphoto"picbyte)
 
           Cmd.Parameters.AddWithValue("@pname"TextBox3.Text)
 
           Cmd.ExecuteNonQuery()
 
           Cmd.Dispose()
 
           conn.Close()
 
           cleartextbox()
 
           MsgBox("تم حفظ السجل بنجاح"64"حريف برمجة")
 
       End If
 
   End Sub