How to save and access image field

Giganews Newsgroups
Subject:How to save and access image field
Posted by: Pak Tse (alan_nospam_pltse@yahoo.com.au)
Date:Sat, 27 Sep 2008

D7.

I have a table in Access:
Employee:
EmpID Integer AutoNumber,
EmpName Text(50),
Picture (OLE/Object)

On the main form I have a text box and TImage.
After I entered the name of the employee and load the jpeg to the TImage, I
want to save into the table.

What should I do to assign the parameter in the query of this picture:

qryAddNewEmployee:
INSERT INTO Emp (EmpName, Picture)
VALUES (:EmpName, :EmpPicture)

with qryAddNewEmployee do
try
  Close;
  Parameters.ParamByName('EmpName').Value := edtName.Text;
  Parameters.ParamByName('EmpPicture').Value := <-- what should be here
  ExecSQL;
except
end;

And also if I want to fetch the records from the table, how to load into the
TImage?
qryFetchEmployee:
SELECT *
FROM Emp
WHERE EmpID = 34

with qryFetchEmployee do
try
  Close;
  Open;
  edtName.Text :=  FieldByName('EmpName').AsString;
                        :=  FieldByName('EmpPicture').  <-- what should be
here

except
end;

Replies