resolved- saving imagebox content to SQL Server
I couldn't find much on this forum to show how to do this so once I figured it out I thought someone else might benefit from this code snipet. later...
Code:
' dimension a memory stream to hold contents of imagebox
Dim myStream As New IO.MemoryStream()
' load imagebox image into memory stream
vfCaptured.Image.Save(myStream, Drawing.Imaging.ImageFormat.Jpeg)
' establish database connection
Dim cn As New SqlClient.SqlConnection("data source=MYDATASOURCE;initial catalog=MYDATABASE;persist security info=False;user id=sa;workstation id=SHX20476;packet size=4096;password=mypassword")
' create SQL statement with image parameter
Dim cmd As New SqlClient.SqlCommand("Insert Into ImageTable Values ('12345',@Picture)", cn)
' define image parameter content from memory stream
Dim P As New SqlClient.SqlParameter("@Picture", SqlDbType.Image, myStream.ToArray.Length, ParameterDirection.Input, False, 0, 0, Nothing, DataRowVersion.Current, myStream.ToArray())
' add parameter
cmd.Parameters.Add(P)
' open database and execute command to store image
cn.Open()
cmd.ExecuteNonQuery()
cn.Close()