Problem inserting image

Поиск
Список
Период
Сортировка
Искать

Problem inserting image

От:
Tk421 <vrobador@gmail.com>
Дата:
     I've made a routine in VB to insert a image into a table. The code is:

         Set cmd = New ADODB.Command
            cmd.ActiveConnection = objconexion
            cmd.CommandText = "INSERT INTO tb_tmp_ventanas (ventana) VALUES (?)"
            archivo = "c:\image.jpg"
            fd = FreeFile
            Open archivo For Binary Access Read As fd
            flen = LOF(fd)
            Set imagen = cmd.CreateParameter("imagen", adLongVarBinary, adParamInput, flen)
            ReDim chunk(1 To flen)
            Get fd, , chunk()
            imagen.AppendChunk chunk()
            cmd.Parameters.Append imagen
            Set rsInsert = cmd.Execute
            Close

      

    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

    Thank you very much

Re: Problem inserting image

От:
"Richard Broersma" <richard.broersma@gmail.com>
Дата:
On Mon, Dec 22, 2008 at 12:08 PM, Tk421  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

FAQ