Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > General

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
Old 01-22-2001, 09:08 PM
FrankySa FrankySa is offline
Member
 
Join Date: Jan 2001
Posts: 81
Default Cannot perform this operation on a closed dataset...

HI there, which of you experts can help me please.
I need to retrieve images and then display them
in a DBImage(imgStaffPhoto). Here is the source code that I have so far.
Thanking you,
=================================================
var
TempStream : TMemoryStream;
begin
TempStream:= TMemoryStream.Create;
TempStream.SaveToFile('Temp.bmp');
ImgStaffPhoto.Picture.Bitmap.LoadFromStream(TempSt ream);

With DM.qryStaffP do begin

Edit;
TBlobField(FieldByName('photo')).LoadFromStream(Te mpStream);

Post;
end;
TempStream.Free;
end;
================================================== =========
Reply With Quote
  #2  
Old 01-22-2001, 09:37 PM
digitiger digitiger is offline
Senior Member
 
Join Date: Jan 2001
Posts: 716
Default RE: Cannot perform this operation on a closed dataset...

most probably you forgot to open the dataset or maybe in btn the code you are closing it somewhere and then forgetting to open it again . any case just insert one line in your second procedure like below

With DM.qryStaffP do begin

-----> Open; {/// just to make sure that the qry is open, it would not harm even if that was already opened but just in case it was close , the dataset would be opened }

Edit;
TBlobField(FieldByName('photo')).LoadFromStream(Te mpStream);

Post;
end;
TempStream.Free;

hope this solves your problem
Reply With Quote
  #3  
Old 01-22-2001, 09:50 PM
FrankySa FrankySa is offline
Member
 
Join Date: Jan 2001
Posts: 81
Default RE: RE: Cannot perform this operation on a closed dataset...

Hi again,

Yes thanks, that solved the first problem, but now I get this.

"qryStaffP: Cannot modify a read only dataset"
Reply With Quote
  #4  
Old 01-22-2001, 10:42 PM
Zeno Zeno is offline
Junior Member
 
Join Date: Jan 2001
Posts: 29
Default RE: RE: RE: Cannot perform this operation on a closed dataset...

If you are using TQuery you have to set the RequestLive property to true. If this will make an error that it is not posible, because dataset is read-only, you have to set RequesetLive to false, CachedUpdates to true, put TUpdateSQL into the form, assign it in the datset's property UpdateSQL and double click on the TUpdateSQL. Choose your primary key in the left list and all others in the second, the click on GenerateSQL button. But then you have to use Dataset.ApplyUpdates after post Method and CancelUpdates after Cancel Method. (eventualy with a check of PendingUpdates property if it is meaningfull to use it)
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT. The time now is 01:02 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.