By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,569 Members | 1,615 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,569 IT Pros & Developers. It's quick & easy.

picture saving in mysql using vb.net in window7

P: 1
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.
'^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand|Select|Wrap|Line Numbers
  1. Dim ms As MemoryStream = New MemoryStream
  2. PictureBox1.Image.Save(ms, Imaging.ImageFormat.Jpeg)
  3. Dim bytBLOBData(ms.Length - 1) As Byte
  4. ms.Position = 0
  5. ms.Read(bytBLOBData, 0, ms.Length)
  6. Dim prm As New MySql.Data.MySqlClient.MySqlParameter("@BLOBData", MySql.Data.MySqlClient.MySqlDbType.LongBlob, _
  7. bytBLOBData.Length, ParameterDirection.Input, False, _
  8. 0, 0, Nothing, DataRowVersion.Current, bytBLOBData)
  9. Dim ekle As New MySql.Data.MySqlClient.MySqlCommand("update ogrenci set resim=@BLOBData where id='" & ogrid & "'", cnn)
  10. ekle.CommandType = CommandType.Text
  11.  
  12. ekle.Parameters.Add(prm)
  13. Dim gln As Byte
  14. cnn.Open()
  15. gln = ekle.ExecuteNonQuery()
  16. MsgBox(gln.ToString)
  17. cnn.Close()
'^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
What is the problem with it???????????
Sep 12 '13 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.