Re: Help with AfterScroll Event for Tadoquery




>Hi Guys, I do not understand how to write a code for
>afterscroll event.
>Here is my problem : I run query, display values in the grid,
>then once I user hit on single record I want to show an image
>on the form ( MS Sql has one field declared as blob)
>I was able to do this by using drop components from Delphi ( ver 7). But when I try to do everything myself I am not able to see the image. Here is my code, any help but we great:
I don't have time to test your code but I will give you code I have tested

procedure TForm1.Table1AfterScroll(DataSet: TDataSet);
var
MS: TMemoryStream;
J1: TJPEGImage;
begin
J1 := TJPEGImage.Create;
MS := TMemoryStream.Create;
try
TBlobField(DataSet.Fieldbyname('myBlob')).SaveToStream(MS);
MS.Seek(0,soFromBeginning);
with J1 do begin
PixelFormat := jf24Bit;
Scale := jsFullSize;
Grayscale := False;
Performance := jpBestQuality;
ProgressiveDisplay := True;
ProgressiveEncoding := True;
LoadFromStream(MS);
end;
if MS.Size >0 then
Image1.Picture.Assign(J1)
else
Image1.Picture.Assign(nil);

finally
J1.Free;
MS.Free;
end;
end;

--
Brian Bushay (TeamB)
Bbushay@xxxxxxxxx
.



Relevant Pages

  • Re: Optimizing for speed
    ... > Simple query which returns ... I'd like to inmediately display records and allow user ... >> I'd consider is how much data am I loading in the grid vs. what the user ... >> in others where this isn't the bottleneck the differences aren't worth ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: Optimizing for speed
    ... The query itself is fast, it's actually the loop that reads all the records ... I'd like to inmediately display records and allow user ... > I'd consider is how much data am I loading in the grid vs. what the user ... > in others where this isn't the bottleneck the differences aren't worth ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: Problem deleting records from datagrid
    ... However the records displayed in the datagrid need to have the description ... I would then need to refresh the data grid to display the changed data ... >> Yes, there are two tables in this query and one does have a primary key, ...
    (microsoft.public.vb.general.discussion)
  • Combobox and Grid on Windows Form
    ... I have a combo box and a grid on the windows form. ... containing all of the information with the join query. ... grid will not display the way I want it to. ... I dont mind doing that, ...
    (microsoft.public.dotnet.framework.adonet)