تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
String or binary data would be truncated. The statement has been terminated.
#1
احاول احفظ صور متعددة الى قاعدة بيانات sql server بعد تحويلها الى binary لكن اتفاجا بظهور رسالة الخطا:
String or binary data would be truncated.
The statement has been terminated.
مع انه تم حفظ ثلاث صور فقط من المجلد ..الكود هو :
كود :
For Each fl In IO.Directory.GetFiles(fbd.SelectedPath & "\")
            If IO.Path.GetExtension(IO.Path.GetFileName(fl)) = ".jpg" = True Or IO.Path.GetExtension(IO.Path.GetFileName(fl)) = ".gif" Or IO.Path.GetExtension(IO.Path.GetFileName(fl)) = ".png" Or IO.Path.GetExtension(IO.Path.GetFileName(fl)) = ".jpeg" Or IO.Path.GetExtension(IO.Path.GetFileName(fl)) = ".JPG" Then
                'MsgBox(IO.Path.GetExtension(IO.Path.GetFileName(fl)))
                ' MsgBox("jpg")
                Dim p() As Byte = My.Computer.FileSystem.ReadAllBytes(IO.Path.GetFullPath(fl))
                Dim cm As New SqlCommand("insert into pic (picname,picbyte) values (@picname,@picbyte)", con)






                cm.Parameters.AddWithValue("@picname", SqlDbType.VarChar).Value = IO.Path.GetFileName(fl)




                cm.Parameters.AddWithValue("@picbyte", p)












                cm.ExecuteNonQuery()
                ProgressBar1.Value += 1
                ll.Text = ProgressBar1.Value


            End If
        Next
ارجو المساعدة لحل هذا الاشكال فقد بحثت بقوقل بالعربي والانجليزي وكل ما وجدته لم يحل.
الرد }}}
تم الشكر بواسطة:
#2
عرفت المشكلة وهي ابسط مما كنت اتصور وهي ان عمود اسم الملف حجمة اقل من اسم بعض ملفات الصور
الرد }}}
تم الشكر بواسطة:


المواضيع المحتمل أن تكون متشابهة .
الموضوع : الكاتب الردود : المشاهدات : آخر رد
  جملة الاتصال connection string GhassanNaeem 1 2,524 28-03-19, 02:33 AM
آخر رد: Amir_Alzubidy

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


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