hadinatayp
Well-known member
- Joined
- Feb 8, 2006
- Messages
- 95
- Programming Experience
- Beginner
I have an image = "WaterLilies.jpg", i tried to save this image to database (MS SQL), and the code which i use to convert and save to database,
then i retrieve the saved record and try to convert it back to image
The error message : The parameter is not valid.
can anybody help me please...
Thank you
VB.NET:
Dim fs As New FileStream("waterlilies.jpg", FileMode.Open, FileAccess.ReadWrite)
Dim arrByte(fs.Length) As Byte
fs.Read(arrByte, 0, fs.Length)
' the insert code goes here......
VB.NET:
'retrievement code........
Dim arrByte() as byte = ds.pic(1).images
Dim ms As New MemoryStream(arrByte, True)
ms.Write(arrByte, 0, arrByte.Length)
' the problem occurs here
Dim i As Image = Image.FromStream(ms)
PictureBox1.Image = i
can anybody help me please...
Thank you