george_4
asked on
database problem with delphi progra
hi i wrote a program which generates buttons with the fields from the database but i would really like that button generation program to generate pictures instead of the text field to do exacly teh same generate buttons but wit6h the pictures.
i cannot post it anywhere but if somebody feels up to the task the all they have to do is supply me with the e-mail and i will send that file to them
then afterwe done we will post the source code
i am using access database for now
thanks
ps.picture generation programm which will take the pictures stored in the databse under the text fields
thanks
i cannot post it anywhere but if somebody feels up to the task the all they have to do is supply me with the e-mail and i will send that file to them
then afterwe done we will post the source code
i am using access database for now
thanks
ps.picture generation programm which will take the pictures stored in the databse under the text fields
thanks
it goes easier, via typecasting like
//store -> dataset must be in edit/insert-mode
TBlobField(Dataset,FieldBy Name('Blob FieldName' )).LoadFro mFile('Fil eNameHere) ; //or LoadFromStream
//get
TBlobField(Dataset,FieldBy Name('Blob FieldName' )).SaveToF ile('FileN ameHere); //or SaveToStream
meikl ;-)
//store -> dataset must be in edit/insert-mode
TBlobField(Dataset,FieldBy
//get
TBlobField(Dataset,FieldBy
meikl ;-)
oops there should be a dot :-))
Dataset,FieldByName -> Dataset.FieldByName
Dataset,FieldByName -> Dataset.FieldByName
I've had problems in the past when I didn't use a TADOBlobStream.
I think there is a discussion about it on delphi.about.com, I'll have to find the link.
I think there is a discussion about it on delphi.about.com, I'll have to find the link.
well, the typecast causes,
that vcl-intern the blobstream is created and freed,
like your code above (which looks good)
there may a problem with persistent fields
(which is not used by this typecast)
would be nice, if you find the link, roknjohn
meikl ;-)
that vcl-intern the blobstream is created and freed,
like your code above (which looks good)
there may a problem with persistent fields
(which is not used by this typecast)
would be nice, if you find the link, roknjohn
meikl ;-)
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
ok
but i already have it generate buttons from the text fields now i want that program
to read the pictures beside instead of the text field and i aslo have no idea how to put it in access
i can send the source if anybody wants to take a look
or better i will post it tonight once i get home
thanks
but i already have it generate buttons from the text fields now i want that program
to read the pictures beside instead of the text field and i aslo have no idea how to put it in access
i can send the source if anybody wants to take a look
or better i will post it tonight once i get home
thanks
ASKER
ok and i want to read from the same table from the databse
procedure LoadBlobStream(Stream : TStream; Blob : TBlobField);
var
dbStream : TADOBlobStream;
begin
try
dbStream := TADOBlobStream.Create(Blob
dbStream.SaveToStream(Stre
finally
dbStream.Free;
end;
end;
procedure SaveBlobStream(Stream : TStream; Blob : TBlobField);
var
dbStream : TADOBlobStream;
begin
with Blob.DataSet do begin
if State = dsBrowse then
Edit;
try
dbStream := TADOBlobStream.Create(Blob
dbStream.LoadFromStream(St
finally
dbStream.Free;
end;
end;
end;
What kind of button control did you have in mind?