Thread: Problem inserting image

Problem inserting image

From
Tk421
Date:
    I've made a routine in VB to insert a image into a table. The code is:<br /><br />          <small>Set cmd = New
ADODB.Command<br/>             cmd.ActiveConnection = objconexion<br />             cmd.CommandText = "INSERT INTO
tb_tmp_ventanas(ventana) VALUES (?)"<br />             archivo = "c:\image.jpg"<br />             fd = FreeFile<br />
           Open archivo For Binary Access Read As fd<br />             flen = LOF(fd)<br />             Set imagen =
cmd.CreateParameter("imagen",adLongVarBinary, adParamInput, flen)<br />             ReDim chunk(1 To flen)<br />
           Get fd, , chunk()<br />             imagen.AppendChunk chunk()<br />             cmd.Parameters.Append
imagen<br/>             Set rsInsert = cmd.Execute<br />             Close</small><br />        <br /><br />     But on
executethere is the next error: ERROR: type "lo" does not exist;<br /><br />     How can i reference the "lo" type or
createit, in postgres 8.3<br /><br />     Thank you very much<br /> 

Re: Problem inserting image

From
"Richard Broersma"
Date:
On Mon, Dec 22, 2008 at 12:08 PM, Tk421 <vrobador@gmail.com> wrote:

>     I've made a routine in VB to insert a image into a table. The code is:
>     But on execute there is the next error: ERROR: type "lo" does not exist;
>
>     How can i reference the "lo" type or create it, in postgres 8.3

Here is an example how how ADODB.Stream class work in conjunction with
ADODB.command prepared statements to push binary data into a field.
The same should work with PostgreSQL.

http://www.databasedevelopment.co.uk/examples/StoredBlobs.zip



-- 
Regards,
Richard Broersma Jr.

Visit the Los Angeles PostgreSQL Users Group (LAPUG)
http://pugs.postgresql.org/lapug