Forum > General

Function ParamByName don't exist on UIB2.

(1/1)

marcosmodolo:
Hi,

  I'm trying to insert a image in firebird with UIB2 with a function that I use on delphi, but on UIB2 and lazarus don't exist the function parambyname. How can I  resolve this problem? The function that I'm using is below:

=================================================

//SALVA IMAGEM BMP NO BANCO, QUANDO JPEG DA PROBLEMA
procedure TForm1.Button2Click(Sender: TObject);
var
b:TMemoryStream;
MyJPEG : TJPEGImage;
begin
  qfoto.sql.clear;
  qfoto.sql.add('insert into fotos (foto)');
  qfoto.SQL.Add('values (:image_foto)');
  try
    b:=TMemoryStream.Create;
    MyJPEG := TJPEGImage.Create;
    myjpeg.LoadFromFile(openimage.FileName);
    myjpeg.SaveToStream(b);
    qfoto.ParamByName('image_foto').LoadFromStream(b,ftBlob);
    qfoto.
    qfoto.ExecSQL;
    Application.MessageBox('Imagem inserida com sucesso','Sucesso :');
  except
  on e:exception do
     begin
       Application.MessageBox(Pchar(e.message),'Erro ao inserir image :');
       b.Destroy;
       Exit;
     end;
  end;
  b.Destroy;
  myjpeg.Free;
end;
===============================================

Tks,

Marcos Módolo

Galileo:
Marcos:

You can post your question too in the Forums of Progdigy, especially in the UIB forum:

http://www.progdigy.com/modules.php?name=Forums&file=viewforum&f=4

I think that they can help you more accuracy.

Have a nice day. Eduardo.

marcosmodolo:
Thank you!

I resolved it by changing the function for this:

qfoto.paramssetblob('image_foto',b);

Have a nice day for you too.

Marcos Módolo

Navigation

[0] Message Index

Go to full version