Answered by:
hello guys can u please help me how to save images in mysql?

Question
-
Public Class Form1 Dim f As New Capture Dim conn As New MySqlConnection("server='localhost'; uid='root'; pwd=''; database='cam';") Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load End Sub Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Timer1.Start() End Sub Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click Timer1.Stop() End Sub Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick Try PictureBox1.Image = f.QueryFrame.ToBitmap() Catch ex As Exception f = New Capture End Try End Sub Private Sub btnsave_Click(sender As Object, e As EventArgs) Handles btnsave.Click Dim ms As New MemoryStream PictureBox1.Image.Save(ms, PictureBox1.Image.RawFormat) Dim dataBuff As Byte() = ms.GetBuffer() Dim p As New MySqlParameter("@img", MySqlDbType.LongBlob) Dim cmd As New MySqlCommand("insert into picture (image) values(@img)", conn) p.Value = dataBuff cmd.Parameters.Add(p) conn.Open() cmd.ExecuteNonQuery() conn.Close() End Sub End Class
- Moved by Dave PatrickMVP Wednesday, March 28, 2018 6:43 PM
Wednesday, March 28, 2018 6:40 PM
Answers
-
I'd ask for help with MySQL over here.
or for general coding help I'd ask here.
https://social.msdn.microsoft.com/Forums/vstudio/en-US/home?category=vslanguages
Regards, Dave Patrick ....
Microsoft Certified Professional
Microsoft MVP [Windows Server] Datacenter Management
Disclaimer: This posting is provided "AS IS" with no warranties or guarantees, and confers no rights.- Proposed as answer by Richard MuellerMVP Wednesday, March 28, 2018 8:17 PM
- Marked as answer by Just Karl Thursday, April 5, 2018 7:21 PM
Wednesday, March 28, 2018 6:45 PM -
Although you are in the wrong forum, here is an answer: https://social.msdn.microsoft.com/Forums/vstudio/en-US/9c197c85-4236-48dd-9dad-17ff5b2d9128/vbnet-get-snap-of-webcam?forum=vbgeneral
- Proposed as answer by Richard MuellerMVP Wednesday, April 4, 2018 12:22 PM
- Marked as answer by Just Karl Thursday, April 5, 2018 7:22 PM
Thursday, March 29, 2018 6:07 AM
All replies
-
their is no error in my code and i can save manually in mysql by importing images from my files but what i want to do is capturing image from my webcam and just clicking the save button to save it
Wednesday, March 28, 2018 6:44 PM -
I'd ask for help with MySQL over here.
or for general coding help I'd ask here.
https://social.msdn.microsoft.com/Forums/vstudio/en-US/home?category=vslanguages
Regards, Dave Patrick ....
Microsoft Certified Professional
Microsoft MVP [Windows Server] Datacenter Management
Disclaimer: This posting is provided "AS IS" with no warranties or guarantees, and confers no rights.- Proposed as answer by Richard MuellerMVP Wednesday, March 28, 2018 8:17 PM
- Marked as answer by Just Karl Thursday, April 5, 2018 7:21 PM
Wednesday, March 28, 2018 6:45 PM -
their is no error in my code and i can save manually in mysql by importing images from my files but what i want to do is capturing image from my webcam and just clicking the save button to save it
Hello,
you say that you can save images into mysql. You only don't know how to capture a picture from webcam.
Accordingly it is not a question about mysql but a question about capturing a photo from webcam.
So I would ask here how to capture an image from webcam: https://social.msdn.microsoft.com/Forums/vstudio/en-US/home?forum=vbgeneral
Thursday, March 29, 2018 6:05 AM -
Although you are in the wrong forum, here is an answer: https://social.msdn.microsoft.com/Forums/vstudio/en-US/9c197c85-4236-48dd-9dad-17ff5b2d9128/vbnet-get-snap-of-webcam?forum=vbgeneral
- Proposed as answer by Richard MuellerMVP Wednesday, April 4, 2018 12:22 PM
- Marked as answer by Just Karl Thursday, April 5, 2018 7:22 PM
Thursday, March 29, 2018 6:07 AM