picture saving in mysql using vb.net in window7

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Sabir
    New Member
    • Sep 2013
    • 1

    picture saving in mysql using vb.net in window7

    I want to save picture in mysql database using vb.net. it work in Window8 and xp but not working in window7. following is the code.
    '^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^ ^^
    Code:
    Dim ms As MemoryStream = New MemoryStream
    PictureBox1.Image.Save(ms, Imaging.ImageFormat.Jpeg)
    Dim bytBLOBData(ms.Length - 1) As Byte
    ms.Position = 0
    ms.Read(bytBLOBData, 0, ms.Length)
    Dim prm As New MySql.Data.MySqlClient.MySqlParameter("@BLOBData", MySql.Data.MySqlClient.MySqlDbType.LongBlob, _
    bytBLOBData.Length, ParameterDirection.Input, False, _
    0, 0, Nothing, DataRowVersion.Current, bytBLOBData)
    Dim ekle As New MySql.Data.MySqlClient.MySqlCommand("update ogrenci set resim=@BLOBData where id='" & ogrid & "'", cnn)
    ekle.CommandType = CommandType.Text
    
    ekle.Parameters.Add(prm)
    Dim gln As Byte
    cnn.Open()
    gln = ekle.ExecuteNonQuery()
    MsgBox(gln.ToString)
    cnn.Close()
    '^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^ ^^
    What is the problem with it???????????
    Last edited by Rabbit; Sep 12 '13, 03:28 PM. Reason: Please use code tags when posting code or formatted data.
Working...