Morning all,
I have the following code that gets a jpg image from sql which works fine.
What i would now like to do is save this image as a file on my pc in a temp folder that i can use in a report. i would like to change the name of this image to the sheltercode. can this be done.
below is the code that i use to get the image from the sql table and populate into a picture box on my form.
conn.Open()
Using cmd As New SqlClient.SqlCommand("Select Imagedata From animalimage where sheltercode ='" & Me.lbshelter.Text & "'", conn)
Using dr As SqlClient.SqlDataReader = cmd.ExecuteReader()
Using dt As New DataTable
dt.Load(dr)
If dt.Rows.Count = 0 Then Exit Sub
Dim row As DataRow = dt.Rows(0)
Using ms As New IO.MemoryStream(CType(row("Imagedata"), Byte()))
Dim img As Image = Image.FromStream(ms)
PictureBox1.Image = img
End Using
End Using
End Using
End Using
End Using
PictureBox1.SizeMode = PictureBoxSizeMode.StretchImage