Does anyone know how to insert a picture into a database using an SQL statement? I also need to know how to retrieve that image from the database and load it into a picture box.
The only way I know is to write the contents of the picturebox to a temporary file, then read in the file (in banary mode) then use the AppendChunck method to build the field (which is an OLE field).
To get the picture back, you do the reverse except you use GetChunck instead of AppendChunck.
I have done it an the application works fine.
Do you need more info??
Greg. "Life is full of learning, and then there is wisdom"
I am gonna need moe info if I go this route. The image needs to be loaded into the database suing activer server pages and retrieved using a vb application. Does this complicate things?
1) To put the image in the DB: use "SavePicture" to write the image to a tempory file, then using "InputB" to read it in and for each InputB chunck using .AppendChunck (iteratively) to build the field.
2) To get the image from the DB: use .GetChunck to grab each part of the field and write it to a temp file then use the "LoadPicture" function to save the image.
The documentation in the MSDN is quite extensive on this.
Is this enough info?
"Life is full of learning, and then there is wisdom"
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.