Re: [DUG] Images and MS SQL Server

2008-08-18 Thread Todd Martin
Oops.

TPicture.RegisterFileFormat is only needed for clx forms/components.

Todd.

> I don't see why not. You probably just need to add 'jpeg' to your "uses" 
> clause and
> TPicture.RegisterFileFormat('jpg', 'JPeg Image', TBitmap);
> TPicture.RegisterFileFormat('jpeg', 'JPeg Image', TBitmap);
> in the "initialization" section.
>
> You should be able to load a jpeg from stream after that.
>
> Todd.
>
>   
>> Maybe you need to work with BMP - there seem to be behind the scenes
>> limitations with what works with JPGs
>>
>> I wrote a program to resize JPEGS, I found there were some tricks about what
>> you could do, it seems in general its less puzzling in Delphi to work with
>> BMP but you can easily convert back and forth
>>
>> You may want to experiment with some code like
>> ImageIn: TImage;
>> ImageOut: TImage;
>>
>>   JPGIn : TJPegImage;
>>   BMPIn : TBitMap;
>>   JPGOut : TJPegImage;
>>   BMPOut : TBitMap;
>>
>> //Jpeg in to BMP in order to display or resize
>>   JPGIn := TJPegImage.Create;
>>   JPGIn.LoadFromFile(FileIn);
>>   BMPIn := TBitMap.Create;
>>   BMPIn.Assign(JPGIn);
>>   ImageIn.Picture.Assign(BMPIn);
>>
>>
>>
>> //BMPto JPG
>>   JPGOut := TJPegImage.Create;
>>   BMPOut := TBitMap.Create;
>>   BMPOut.Assign(JPGOut);
>>   ImageOut.Picture.Assign(BMPOut);
>>
>>   JPGOut.Assign(BMPOut);
>>
>>
>> As an aside I found you can resize the BMP with code like
>>   JPGOut:=JPGIn;
>>   BMPOut.Width:=WidthOut;
>>   BMPOut.Height:=HeightOut;
>>   BMPOut.Canvas.Stretchdraw(Rect(0,0,WidthOut,HeightOut),JPGOut);
>>
>> John
>>
>>
>> -Original Message-
>> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
>> Behalf Of Neven MacEwan
>> Sent: Tuesday, 19 August 2008 11:28 a.m.
>> To: NZ Borland Developers Group - Delphi List
>> Subject: Re: [DUG] Images and MS SQL Server
>>
>>
>> Dave
>>   
>> 
>>> It actually appears to be something to do with the image being a jpeg. 
>>> If I use a bitmap image, the TDBImage shows the bitmap correctly.
>>> 
>>>   
>> Yes i don't think TDBImage supports JPGs by default
>>
>> Have you tried datamod.
>>
>> var
>>   ImgField: TBlobField;
>> ADOQ.SQL.Text := 'Select * from StockCats where ID ='+InttoStr(ID) ;
>> datamod.ADOQ.Open ; try  if not datamod.ADOQ.EOF then
>> begin
>>ID := datamod.ADOQ.FieldByName('ID').AsInteger ;
>>edtCategory.Text :=  
>> Trim(datamod.ADOQ.FieldByName('Category').AsString) ;
>>moDescr.Text := 
>> Trim(datamod.ADOQ.FieldByName('Description').AsString) ;
>>ms := TMemoryStream.Create ;
>>try
>>  ImgField := datamod.ADOQ.FieldByName('Image');
>>  ImgField.SaveToStream(ms);
>>  Image.Picture.Bitmap.LoadFromStream(ms);
>>finally
>>   st.Free ;
>> end ;
>>   finally
>> ms.Free ;
>>   end ;
>> end ;
>>   finally
>> datamod.ADOQ.Close ;
>>   end ;
>>
>>
>>
>>   
>> 
>>> -Original Message-
>>> From: [EMAIL PROTECTED] 
>>> [mailto:[EMAIL PROTECTED]
>>> On Behalf Of Neven MacEwan
>>> Sent: Tuesday, 19 August 2008 10:18 a.m.
>>> To: NZ Borland Developers Group - Delphi List
>>> Subject: Re: [DUG] Images and MS SQL Server
>>>
>>> Dave
>>>
>>> Im getting a little confused, have you or have you not managed to 
>>> write
>>> an image to your DB?
>>> You could confirm this with a simple sql query or crystal reports
>>>
>>> If you have you should be able to open the table in the ide and bind a
>>> TDBImage to it
>>>
>>> Neven
>>>   
>>> 
>>>   
>>>> That's exactly what I am doing to save the image, how do I retrieve
>>>> 
>>>>   
>>>> 
>>> it?
>>>   
>>> 
>>>   
>>>> Every method I have tried comes up blank.
>>>>
>>>> -Original Message-----
>>>> From: [EMAIL PROTECTED]
>>>> 
>>>>   
>>>> 
>>> [mailto:[EMAIL PROTECTED]
>>>   
>>> 
>>>

Re: [DUG] Images and MS SQL Server

2008-08-18 Thread Todd Martin
I don't see why not. You probably just need to add 'jpeg' to your "uses" 
clause and
TPicture.RegisterFileFormat('jpg', 'JPeg Image', TBitmap);
TPicture.RegisterFileFormat('jpeg', 'JPeg Image', TBitmap);
in the "initialization" section.

You should be able to load a jpeg from stream after that.

Todd.

> Maybe you need to work with BMP - there seem to be behind the scenes
> limitations with what works with JPGs
>
> I wrote a program to resize JPEGS, I found there were some tricks about what
> you could do, it seems in general its less puzzling in Delphi to work with
> BMP but you can easily convert back and forth
>
> You may want to experiment with some code like
> ImageIn: TImage;
> ImageOut: TImage;
>
>   JPGIn : TJPegImage;
>   BMPIn : TBitMap;
>   JPGOut : TJPegImage;
>   BMPOut : TBitMap;
>
> //Jpeg in to BMP in order to display or resize
>   JPGIn := TJPegImage.Create;
>   JPGIn.LoadFromFile(FileIn);
>   BMPIn := TBitMap.Create;
>   BMPIn.Assign(JPGIn);
>   ImageIn.Picture.Assign(BMPIn);
>
>
>
> //BMPto JPG
>   JPGOut := TJPegImage.Create;
>   BMPOut := TBitMap.Create;
>   BMPOut.Assign(JPGOut);
>   ImageOut.Picture.Assign(BMPOut);
>
>   JPGOut.Assign(BMPOut);
>
>
> As an aside I found you can resize the BMP with code like
>   JPGOut:=JPGIn;
>   BMPOut.Width:=WidthOut;
>   BMPOut.Height:=HeightOut;
>   BMPOut.Canvas.Stretchdraw(Rect(0,0,WidthOut,HeightOut),JPGOut);
>
> John
>
>
> -----Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
> Behalf Of Neven MacEwan
> Sent: Tuesday, 19 August 2008 11:28 a.m.
> To: NZ Borland Developers Group - Delphi List
> Subject: Re: [DUG] Images and MS SQL Server
>
>
> Dave
>   
>> It actually appears to be something to do with the image being a jpeg. 
>> If I use a bitmap image, the TDBImage shows the bitmap correctly.
>> 
> Yes i don't think TDBImage supports JPGs by default
>
> Have you tried datamod.
>
> var
>   ImgField: TBlobField;
> ADOQ.SQL.Text := 'Select * from StockCats where ID ='+InttoStr(ID) ;
> datamod.ADOQ.Open ; try  if not datamod.ADOQ.EOF then
> begin
>ID := datamod.ADOQ.FieldByName('ID').AsInteger ;
>edtCategory.Text :=  
> Trim(datamod.ADOQ.FieldByName('Category').AsString) ;
>moDescr.Text := 
> Trim(datamod.ADOQ.FieldByName('Description').AsString) ;
>ms := TMemoryStream.Create ;
>try
>  ImgField := datamod.ADOQ.FieldByName('Image');
>  ImgField.SaveToStream(ms);
>  Image.Picture.Bitmap.LoadFromStream(ms);
>finally
>   st.Free ;
>     end ;
>   finally
> ms.Free ;
>   end ;
> end ;
>   finally
> datamod.ADOQ.Close ;
>   end ;
>
>
>
>   
>> -Original Message-
>> From: [EMAIL PROTECTED] 
>> [mailto:[EMAIL PROTECTED]
>> On Behalf Of Neven MacEwan
>> Sent: Tuesday, 19 August 2008 10:18 a.m.
>> To: NZ Borland Developers Group - Delphi List
>> Subject: Re: [DUG] Images and MS SQL Server
>>
>> Dave
>>
>> Im getting a little confused, have you or have you not managed to 
>> write
>> an image to your DB?
>> You could confirm this with a simple sql query or crystal reports
>>
>> If you have you should be able to open the table in the ide and bind a
>> TDBImage to it
>>
>> Neven
>>   
>> 
>>> That's exactly what I am doing to save the image, how do I retrieve
>>> 
>>>   
>> it?
>>   
>> 
>>> Every method I have tried comes up blank.
>>>
>>> -Original Message-
>>> From: [EMAIL PROTECTED]
>>> 
>>>   
>> [mailto:[EMAIL PROTECTED]
>>   
>> 
>>> On Behalf Of Leigh Wanstead
>>> Sent: Monday, 18 August 2008 4:32 p.m.
>>> To: NZ Borland Developers Group - Delphi List
>>> Subject: Re: [DUG] Images and MS SQL Server
>>>
>>> IIRC, I will do this way.
>>>
>>> varStream just a memory stream, you might want to instante with a
>>> TFileStream
>>>
>>> ADOQueryTest.sql.text := 'UPDATE table SET FileCol = :FileColOBJECTS
>>>   
>
>   
>>> WHERE ID = :ID';
>>> ...
>>>  
>>> ADOQueryTest.Parameters.ParamByName('FileColOBJECTS').LoadFromStream(
>>> v
>>> arStream, ftBlob);
>>>   ADOQueryTest.ExecSQL;
>>>
>>&

Re: [DUG] Images and MS SQL Server

2008-08-18 Thread John Bird
Maybe you need to work with BMP - there seem to be behind the scenes
limitations with what works with JPGs

I wrote a program to resize JPEGS, I found there were some tricks about what
you could do, it seems in general its less puzzling in Delphi to work with
BMP but you can easily convert back and forth

You may want to experiment with some code like
ImageIn: TImage;
ImageOut: TImage;

  JPGIn : TJPegImage;
  BMPIn : TBitMap;
  JPGOut : TJPegImage;
  BMPOut : TBitMap;

//Jpeg in to BMP in order to display or resize
  JPGIn := TJPegImage.Create;
  JPGIn.LoadFromFile(FileIn);
  BMPIn := TBitMap.Create;
  BMPIn.Assign(JPGIn);
  ImageIn.Picture.Assign(BMPIn);



//BMPto JPG
  JPGOut := TJPegImage.Create;
  BMPOut := TBitMap.Create;
  BMPOut.Assign(JPGOut);
  ImageOut.Picture.Assign(BMPOut);

  JPGOut.Assign(BMPOut);


As an aside I found you can resize the BMP with code like
  JPGOut:=JPGIn;
  BMPOut.Width:=WidthOut;
  BMPOut.Height:=HeightOut;
  BMPOut.Canvas.Stretchdraw(Rect(0,0,WidthOut,HeightOut),JPGOut);

John


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Neven MacEwan
Sent: Tuesday, 19 August 2008 11:28 a.m.
To: NZ Borland Developers Group - Delphi List
Subject: Re: [DUG] Images and MS SQL Server


Dave
>
> It actually appears to be something to do with the image being a jpeg. 
> If I use a bitmap image, the TDBImage shows the bitmap correctly.
Yes i don't think TDBImage supports JPGs by default

Have you tried datamod.

var
  ImgField: TBlobField;
ADOQ.SQL.Text := 'Select * from StockCats where ID ='+InttoStr(ID) ;
datamod.ADOQ.Open ; try  if not datamod.ADOQ.EOF then
begin
   ID := datamod.ADOQ.FieldByName('ID').AsInteger ;
   edtCategory.Text :=  
Trim(datamod.ADOQ.FieldByName('Category').AsString) ;
   moDescr.Text := 
Trim(datamod.ADOQ.FieldByName('Description').AsString) ;
   ms := TMemoryStream.Create ;
   try
 ImgField := datamod.ADOQ.FieldByName('Image');
 ImgField.SaveToStream(ms);
 Image.Picture.Bitmap.LoadFromStream(ms);
   finally
  st.Free ;
end ;
  finally
ms.Free ;
  end ;
end ;
  finally
datamod.ADOQ.Close ;
  end ;



> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED]
> On Behalf Of Neven MacEwan
> Sent: Tuesday, 19 August 2008 10:18 a.m.
> To: NZ Borland Developers Group - Delphi List
> Subject: Re: [DUG] Images and MS SQL Server
>
> Dave
>
> Im getting a little confused, have you or have you not managed to 
> write
> an image to your DB?
> You could confirm this with a simple sql query or crystal reports
>
> If you have you should be able to open the table in the ide and bind a
> TDBImage to it
>
> Neven
>   
>> That's exactly what I am doing to save the image, how do I retrieve
>> 
> it?
>   
>> Every method I have tried comes up blank.
>>
>> -Original Message-
>> From: [EMAIL PROTECTED]
>>     
> [mailto:[EMAIL PROTECTED]
>   
>> On Behalf Of Leigh Wanstead
>> Sent: Monday, 18 August 2008 4:32 p.m.
>> To: NZ Borland Developers Group - Delphi List
>> Subject: Re: [DUG] Images and MS SQL Server
>>
>> IIRC, I will do this way.
>>
>>  varStream just a memory stream, you might want to instante with a
>> TFileStream
>>
>>  ADOQueryTest.sql.text := 'UPDATE table SET FileCol = :FileColOBJECTS

>> WHERE ID = :ID';
>>  ...
>>  
>> ADOQueryTest.Parameters.ParamByName('FileColOBJECTS').LoadFromStream(
>> v
>> arStream, ftBlob);
>>       ADOQueryTest.ExecSQL;
>>
>> Have a nice day
>>
>> Regards
>> Leigh
>> www.smootharm.com
>>
>>
>> -Original Message-
>> From: [EMAIL PROTECTED] 
>> [mailto:[EMAIL PROTECTED] Behalf Of Dave O'Brien
>> Sent: Monday, 18 August 2008 4:17 p.m.
>> To: NZ Borland Developers Group - Delphi List
>> Subject: Re: [DUG] Images and MS SQL Server
>>
>>
>> So did I, but I can't tell if it's not working because it's not 
>> saving or loading...
>>
>> The problem is FieldByName doesn't have any saveto... methods.
>>
>> I have tried to cast it as a Tblobfield 
>> (TBlobField(adoq.fieldbyname('Image')).Saveto...), but either this 
>> doesn't work or my save code doesn't work.
>>
>> -Original Message-
>> From: [EMAIL PROTECTED]
>> 
> [mailto:[EMAIL PROTECTED]
>   
>> On Behalf Of Neven MacEwan
>> Sent: Monday, 18 August 2008 4:06 p.m.
>> To: NZ Borland Developers Group - Delphi List
>> Subject: Re: 

Re: [DUG] Images and MS SQL Server

2008-08-18 Thread Neven MacEwan
Dave
>
> It actually appears to be something to do with the image being a jpeg.
> If I use a bitmap image, the TDBImage shows the bitmap correctly. 
Yes i don't think TDBImage supports JPGs by default

Have you tried datamod.

var
  ImgField: TBlobField;
ADOQ.SQL.Text := 'Select * from StockCats where ID ='+InttoStr(ID) ;
datamod.ADOQ.Open ;
try
 if not datamod.ADOQ.EOF then
begin
   ID := datamod.ADOQ.FieldByName('ID').AsInteger ;
   edtCategory.Text :=  
Trim(datamod.ADOQ.FieldByName('Category').AsString) ;
   moDescr.Text := 
Trim(datamod.ADOQ.FieldByName('Description').AsString) ;
   ms := TMemoryStream.Create ;
   try
 ImgField := datamod.ADOQ.FieldByName('Image');
 ImgField.SaveToStream(ms);
 Image.Picture.Bitmap.LoadFromStream(ms);
   finally
  st.Free ;
end ;
  finally
ms.Free ;
  end ;
end ;
  finally
datamod.ADOQ.Close ;
  end ;



> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> On Behalf Of Neven MacEwan
> Sent: Tuesday, 19 August 2008 10:18 a.m.
> To: NZ Borland Developers Group - Delphi List
> Subject: Re: [DUG] Images and MS SQL Server
>
> Dave
>
> Im getting a little confused, have you or have you not managed to write 
> an image to your DB?
> You could confirm this with a simple sql query or crystal reports
>
> If you have you should be able to open the table in the ide and bind a 
> TDBImage to it
>
> Neven
>   
>> That's exactly what I am doing to save the image, how do I retrieve
>> 
> it?
>   
>> Every method I have tried comes up blank.
>>
>> -Original Message-
>> From: [EMAIL PROTECTED]
>>     
> [mailto:[EMAIL PROTECTED]
>   
>> On Behalf Of Leigh Wanstead
>> Sent: Monday, 18 August 2008 4:32 p.m.
>> To: NZ Borland Developers Group - Delphi List
>> Subject: Re: [DUG] Images and MS SQL Server
>>
>> IIRC, I will do this way.
>>
>>  varStream just a memory stream, you might want to instante with
>> a
>> TFileStream
>>
>>  ADOQueryTest.sql.text := 'UPDATE table SET FileCol =
>> :FileColOBJECTS WHERE
>> ID = :ID';
>>  ...
>>  
>> ADOQueryTest.Parameters.ParamByName('FileColOBJECTS').LoadFromStream(v
>> arStream, ftBlob);
>>       ADOQueryTest.ExecSQL;
>>
>> Have a nice day
>>
>> Regards
>> Leigh
>> www.smootharm.com
>>
>>
>> -Original Message-
>> From: [EMAIL PROTECTED]
>> [mailto:[EMAIL PROTECTED] Behalf Of Dave O'Brien
>> Sent: Monday, 18 August 2008 4:17 p.m.
>> To: NZ Borland Developers Group - Delphi List
>> Subject: Re: [DUG] Images and MS SQL Server
>>
>>
>> So did I, but I can't tell if it's not working because it's not saving
>> or loading...
>>
>> The problem is FieldByName doesn't have any saveto... methods.
>>
>> I have tried to cast it as a Tblobfield
>> (TBlobField(adoq.fieldbyname('Image')).Saveto...), but either this
>> doesn't work or my save code doesn't work.
>>
>> -Original Message-
>> From: [EMAIL PROTECTED]
>> 
> [mailto:[EMAIL PROTECTED]
>   
>> On Behalf Of Neven MacEwan
>> Sent: Monday, 18 August 2008 4:06 p.m.
>> To: NZ Borland Developers Group - Delphi List
>> Subject: Re: [DUG] Images and MS SQL Server
>>
>> Dave
>>
>> I thought you had code to save it?
>>
>> To tretrieve it (rough I don't have )
>>
>> ADOQuery.SQL.Add('SELECT FileCol FROM Table WHERE ID = 1');
>> ADOQuery.Open;
>> ADOQuery.FieldByName('FileCol ').SaveToFile(FileName);
>>
>> FieldByName('FileCol ') should be a TBlobField
>>
>> Neven
>>
>>
>>
>>   
>> 
>>> I've struck a complete blank on this.
>>> Can anyone show me some code to save and load images from SQL Server
>>> using TADOQuery?
>>> The methods I've come up with don't appear to work at all...
>>>
>>> -Original Message-
>>> From: [EMAIL PROTECTED]
>>> 
>>>   
>> [mailto:[EMAIL PROTECTED]
>>   
>> 
>>> On Behalf Of Neven MacEwan
>>> Sent: Friday, 15 August 2008 4:02 p.m.
>>> To: NZ Borland Developers Group - Delphi List
>>> Subject: Re: [DUG] Images and MS SQL Server
>>>
>>> Dave
>>>
>>> Hasn't Tblobfield got the same streaming functions IIRC
>>>
>>>  

Re: [DUG] Images and MS SQL Server

2008-08-18 Thread Leigh Wanstead
That is default by Delphi 7 enterprise. Double click the adoquery component
and bring up a dialog box and right click to select add all fields.

Have a nice day

Regards
Leigh
www.smootharm.com

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Dave O'Brien
Sent: Tuesday, 19 August 2008 10:55 a.m.
To: NZ Borland Developers Group - Delphi List
Subject: Re: [DUG] Images and MS SQL Server


How is ADOQueryGetMacroFileCol defined?

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Leigh Wanstead
Sent: Tuesday, 19 August 2008 10:28 a.m.
To: NZ Borland Developers Group - Delphi List
Subject: Re: [DUG] Images and MS SQL Server

I assume this code should help.

  ADOQueryGetMacro.sql.text := 'SELECT FileCol FROM table WHERE ID =
:ID';
  ADOQueryGetMacro.Parameters.ParamByName('ID').Value := someID;
  ADOQueryGetMacro.Open;
  try
if not ADOQueryGetMacro.EOF then
begin
  varStream := TMemoryStream.Create;
  try
ADOQueryGetMacroFileCol.SaveToStream(varStream);
  ... do something useful here
  finally
FreeAndNil(varStream);
  end;
end;
  finally
ADOQueryGetMacro.Close;
  end;

Have a nice day

Regards
Leigh
www.smootharm.com


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Dave O'Brien
Sent: Tuesday, 19 August 2008 10:11 a.m.
To: NZ Borland Developers Group - Delphi List
Subject: Re: [DUG] Images and MS SQL Server


That's exactly what I am doing to save the image, how do I retrieve it?
Every method I have tried comes up blank.

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Leigh Wanstead
Sent: Monday, 18 August 2008 4:32 p.m.
To: NZ Borland Developers Group - Delphi List
Subject: Re: [DUG] Images and MS SQL Server

IIRC, I will do this way.

varStream just a memory stream, you might want to instante with
a
TFileStream

ADOQueryTest.sql.text := 'UPDATE table SET FileCol =
:FileColOBJECTS WHERE
ID = :ID';
...

ADOQueryTest.Parameters.ParamByName('FileColOBJECTS').LoadFromStream(v
arStream, ftBlob);
  ADOQueryTest.ExecSQL;

Have a nice day

Regards
Leigh
www.smootharm.com


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Dave O'Brien
Sent: Monday, 18 August 2008 4:17 p.m.
To: NZ Borland Developers Group - Delphi List
Subject: Re: [DUG] Images and MS SQL Server


So did I, but I can't tell if it's not working because it's not saving
or loading...

The problem is FieldByName doesn't have any saveto... methods.

I have tried to cast it as a Tblobfield
(TBlobField(adoq.fieldbyname('Image')).Saveto...), but either this
doesn't work or my save code doesn't work.

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Neven MacEwan
Sent: Monday, 18 August 2008 4:06 p.m.
To: NZ Borland Developers Group - Delphi List
Subject: Re: [DUG] Images and MS SQL Server

Dave

I thought you had code to save it?

To tretrieve it (rough I don't have )

ADOQuery.SQL.Add('SELECT FileCol FROM Table WHERE ID = 1');
ADOQuery.Open;
ADOQuery.FieldByName('FileCol ').SaveToFile(FileName);

FieldByName('FileCol ') should be a TBlobField

Neven



> I've struck a complete blank on this.
> Can anyone show me some code to save and load images from SQL Server
> using TADOQuery?
> The methods I've come up with don't appear to work at all...
>
> -Original Message-
> From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
> On Behalf Of Neven MacEwan
> Sent: Friday, 15 August 2008 4:02 p.m.
> To: NZ Borland Developers Group - Delphi List
> Subject: Re: [DUG] Images and MS SQL Server
>
> Dave
>
> Hasn't Tblobfield got the same streaming functions IIRC
>
>> I have worked out how to save an image into an Image field, but I'm
>> having brain fade on how to retrieve the image... Using TADOQuery,
>>
> D2005.
>
>> Save:
>>
>> ...
>>
>> datamod.ADOU.SQL.Add(':Image)') ;
>>
>> ms := TMemoryStream.Create ;
>>
>> try
>>
>> Image.Picture.Bitmap.SaveToStream(ms);
>>
>> ms.seek(0,0) ;
>>
>> datamod.ADOU.Parameters.ParamByName('Image').LoadFromStream(ms,
>> ftGraphic);
>>
>> finally
>>
>> ms.Free ;
>>
>> end ;
>>
>> datamod.ADOU.ExecSQL ;
>>
>> Anyone (I suppose everyone has) got a way to get the image back?
>>
>> Cheers,
>>
>> Dave.
>>
>>
>>
>

>
>> ___
>> NZ Borland Developers Grou

Re: [DUG] Images and MS SQL Server

2008-08-18 Thread Dave O'Brien
I have just created a new prog, using TADOConnection, TADOTable,
TDataSource, TDBImage, TDBNavigator. The TDBImage is empty. Here is the
code I am using to save the image:

Image is a TImage, ID is correctly defined as the other fields are
correctly saved.

datamod.ADOU.SQL.Text := 'Update StockCats' ;
datamod.ADOU.SQL.Add('Set Category = '+Fix(edtCategory.Text)+',') ;
datamod.ADOU.SQL.Add('Description = '+Fix(moDescr.Text)+',') ;
datamod.ADOU.SQL.Add('Image = :Image1') ;
datamod.ADOU.SQL.Add('Where ID = '+InttoStr(ID)) ;
ms := TMemoryStream.Create ;
try
  Image.Picture.Bitmap.SaveToStream(ms) ;
  ms.seek(0,0) ;
  datamod.ADOU.Parameters.ParamByName('Image1').DataType := ftBlob ;
  datamod.ADOU.Parameters.ParamByName('Image1').LoadFromStream(ms,
ftBlob) ;
  datamod.ADOU.ExecSQL ;
finally
  ms.Free ;
end ;

It actually appears to be something to do with the image being a jpeg.
If I use a bitmap image, the TDBImage shows the bitmap correctly. The
following code to retrieve the image (and everything else I've tried)
comes up blank:

  datamod.ADOQ.SQL.Text := 'Select * from StockCats where ID =
'+InttoStr(ID) ;
  datamod.ADOQ.Open ;
  try
if not datamod.ADOQ.EOF then
begin
  ID := datamod.ADOQ.FieldByName('ID').AsInteger ;
  edtCategory.Text :=
Trim(datamod.ADOQ.FieldByName('Category').AsString) ;
  moDescr.Text :=
Trim(datamod.ADOQ.FieldByName('Description').AsString) ;
  ms := TMemoryStream.Create ;
  try
st :=
datamod.adoq.CreateBlobStream(datamod.ADOQ.FieldByName('Image'), bmRead)
;
try
  ms.CopyFrom(st, 0) ;
  Image.Picture.Bitmap.LoadFromStream(ms);
finally
  st.Free ;
end ;
  finally
ms.Free ;
  end ;
end ;
  finally
datamod.ADOQ.Close ;
  end ;

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Neven MacEwan
Sent: Tuesday, 19 August 2008 10:18 a.m.
To: NZ Borland Developers Group - Delphi List
Subject: Re: [DUG] Images and MS SQL Server

Dave

Im getting a little confused, have you or have you not managed to write 
an image to your DB?
You could confirm this with a simple sql query or crystal reports

If you have you should be able to open the table in the ide and bind a 
TDBImage to it

Neven
> That's exactly what I am doing to save the image, how do I retrieve
it?
> Every method I have tried comes up blank.
>
> -Original Message-
> From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
> On Behalf Of Leigh Wanstead
> Sent: Monday, 18 August 2008 4:32 p.m.
> To: NZ Borland Developers Group - Delphi List
> Subject: Re: [DUG] Images and MS SQL Server
>
> IIRC, I will do this way.
>
>   varStream just a memory stream, you might want to instante with
> a
> TFileStream
>
>   ADOQueryTest.sql.text := 'UPDATE table SET FileCol =
> :FileColOBJECTS WHERE
> ID = :ID';
>   ...
>  
> ADOQueryTest.Parameters.ParamByName('FileColOBJECTS').LoadFromStream(v
> arStream, ftBlob);
>   ADOQueryTest.ExecSQL;
>
> Have a nice day
>
> Regards
> Leigh
> www.smootharm.com
>
>
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] Behalf Of Dave O'Brien
> Sent: Monday, 18 August 2008 4:17 p.m.
> To: NZ Borland Developers Group - Delphi List
> Subject: Re: [DUG] Images and MS SQL Server
>
>
> So did I, but I can't tell if it's not working because it's not saving
> or loading...
>
> The problem is FieldByName doesn't have any saveto... methods.
>
> I have tried to cast it as a Tblobfield
> (TBlobField(adoq.fieldbyname('Image')).Saveto...), but either this
> doesn't work or my save code doesn't work.
>
> -Original Message-
> From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
> On Behalf Of Neven MacEwan
> Sent: Monday, 18 August 2008 4:06 p.m.
> To: NZ Borland Developers Group - Delphi List
> Subject: Re: [DUG] Images and MS SQL Server
>
> Dave
>
> I thought you had code to save it?
>
> To tretrieve it (rough I don't have )
>
> ADOQuery.SQL.Add('SELECT FileCol FROM Table WHERE ID = 1');
> ADOQuery.Open;
> ADOQuery.FieldByName('FileCol ').SaveToFile(FileName);
>
> FieldByName('FileCol ') should be a TBlobField
>
> Neven
>
>
>
>   
>> I've struck a complete blank on this.
>> Can anyone show me some code to save and load images from SQL Server
>> using TADOQuery?
>> The methods I've come up with don't appear to work at all...
>>
>> -Original 

Re: [DUG] Images and MS SQL Server

2008-08-18 Thread Dave O'Brien
How is ADOQueryGetMacroFileCol defined?

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Leigh Wanstead
Sent: Tuesday, 19 August 2008 10:28 a.m.
To: NZ Borland Developers Group - Delphi List
Subject: Re: [DUG] Images and MS SQL Server

I assume this code should help.

  ADOQueryGetMacro.sql.text := 'SELECT FileCol FROM table WHERE ID =
:ID';
  ADOQueryGetMacro.Parameters.ParamByName('ID').Value := someID;
  ADOQueryGetMacro.Open;
  try
if not ADOQueryGetMacro.EOF then
begin
  varStream := TMemoryStream.Create;
  try
ADOQueryGetMacroFileCol.SaveToStream(varStream);
  ... do something useful here
  finally
FreeAndNil(varStream);
  end;
end;
  finally
ADOQueryGetMacro.Close;
  end;

Have a nice day

Regards
Leigh
www.smootharm.com


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Dave O'Brien
Sent: Tuesday, 19 August 2008 10:11 a.m.
To: NZ Borland Developers Group - Delphi List
Subject: Re: [DUG] Images and MS SQL Server


That's exactly what I am doing to save the image, how do I retrieve it?
Every method I have tried comes up blank.

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Leigh Wanstead
Sent: Monday, 18 August 2008 4:32 p.m.
To: NZ Borland Developers Group - Delphi List
Subject: Re: [DUG] Images and MS SQL Server

IIRC, I will do this way.

varStream just a memory stream, you might want to instante with
a
TFileStream

ADOQueryTest.sql.text := 'UPDATE table SET FileCol =
:FileColOBJECTS WHERE
ID = :ID';
...

ADOQueryTest.Parameters.ParamByName('FileColOBJECTS').LoadFromStream(v
arStream, ftBlob);
  ADOQueryTest.ExecSQL;

Have a nice day

Regards
Leigh
www.smootharm.com


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Dave O'Brien
Sent: Monday, 18 August 2008 4:17 p.m.
To: NZ Borland Developers Group - Delphi List
Subject: Re: [DUG] Images and MS SQL Server


So did I, but I can't tell if it's not working because it's not saving
or loading...

The problem is FieldByName doesn't have any saveto... methods.

I have tried to cast it as a Tblobfield
(TBlobField(adoq.fieldbyname('Image')).Saveto...), but either this
doesn't work or my save code doesn't work.

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Neven MacEwan
Sent: Monday, 18 August 2008 4:06 p.m.
To: NZ Borland Developers Group - Delphi List
Subject: Re: [DUG] Images and MS SQL Server

Dave

I thought you had code to save it?

To tretrieve it (rough I don't have )

ADOQuery.SQL.Add('SELECT FileCol FROM Table WHERE ID = 1');
ADOQuery.Open;
ADOQuery.FieldByName('FileCol ').SaveToFile(FileName);

FieldByName('FileCol ') should be a TBlobField

Neven



> I've struck a complete blank on this.
> Can anyone show me some code to save and load images from SQL Server
> using TADOQuery?
> The methods I've come up with don't appear to work at all...
>
> -Original Message-
> From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
> On Behalf Of Neven MacEwan
> Sent: Friday, 15 August 2008 4:02 p.m.
> To: NZ Borland Developers Group - Delphi List
> Subject: Re: [DUG] Images and MS SQL Server
>
> Dave
>
> Hasn't Tblobfield got the same streaming functions IIRC
>
>> I have worked out how to save an image into an Image field, but I'm
>> having brain fade on how to retrieve the image... Using TADOQuery,
>>
> D2005.
>
>> Save:
>>
>> ...
>>
>> datamod.ADOU.SQL.Add(':Image)') ;
>>
>> ms := TMemoryStream.Create ;
>>
>> try
>>
>> Image.Picture.Bitmap.SaveToStream(ms);
>>
>> ms.seek(0,0) ;
>>
>> datamod.ADOU.Parameters.ParamByName('Image').LoadFromStream(ms,
>> ftGraphic);
>>
>> finally
>>
>> ms.Free ;
>>
>> end ;
>>
>> datamod.ADOU.ExecSQL ;
>>
>> Anyone (I suppose everyone has) got a way to get the image back?
>>
>> Cheers,
>>
>> Dave.
>>
>>
>>
>

>
>> ___
>> NZ Borland Developers Group - Delphi mailing list
>> Post: delphi@delphi.org.nz
>> Admin: http://delphi.org.nz/mailman/listinfo/delphi
>> Unsubscribe: send an email to [EMAIL PROTECTED] with
>>
> Subject: unsubscribe
>
> ___
> NZ Borland Developers Group - Delphi mailing list
> Post: delphi@delphi.org.nz
> Admin: http://delphi.org.nz/mailman/listinfo/delphi
> Un

Re: [DUG] Images and MS SQL Server

2008-08-18 Thread Leigh Wanstead
I assume this code should help.

  ADOQueryGetMacro.sql.text := 'SELECT FileCol FROM table WHERE ID = :ID';
  ADOQueryGetMacro.Parameters.ParamByName('ID').Value := someID;
  ADOQueryGetMacro.Open;
  try
if not ADOQueryGetMacro.EOF then
begin
  varStream := TMemoryStream.Create;
  try
ADOQueryGetMacroFileCol.SaveToStream(varStream);
  ... do something useful here
  finally
FreeAndNil(varStream);
  end;
end;
  finally
ADOQueryGetMacro.Close;
  end;

Have a nice day

Regards
Leigh
www.smootharm.com


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Dave O'Brien
Sent: Tuesday, 19 August 2008 10:11 a.m.
To: NZ Borland Developers Group - Delphi List
Subject: Re: [DUG] Images and MS SQL Server


That's exactly what I am doing to save the image, how do I retrieve it?
Every method I have tried comes up blank.

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Leigh Wanstead
Sent: Monday, 18 August 2008 4:32 p.m.
To: NZ Borland Developers Group - Delphi List
Subject: Re: [DUG] Images and MS SQL Server

IIRC, I will do this way.

varStream just a memory stream, you might want to instante with
a
TFileStream

ADOQueryTest.sql.text := 'UPDATE table SET FileCol =
:FileColOBJECTS WHERE
ID = :ID';
...

ADOQueryTest.Parameters.ParamByName('FileColOBJECTS').LoadFromStream(v
arStream, ftBlob);
  ADOQueryTest.ExecSQL;

Have a nice day

Regards
Leigh
www.smootharm.com


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Dave O'Brien
Sent: Monday, 18 August 2008 4:17 p.m.
To: NZ Borland Developers Group - Delphi List
Subject: Re: [DUG] Images and MS SQL Server


So did I, but I can't tell if it's not working because it's not saving
or loading...

The problem is FieldByName doesn't have any saveto... methods.

I have tried to cast it as a Tblobfield
(TBlobField(adoq.fieldbyname('Image')).Saveto...), but either this
doesn't work or my save code doesn't work.

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Neven MacEwan
Sent: Monday, 18 August 2008 4:06 p.m.
To: NZ Borland Developers Group - Delphi List
Subject: Re: [DUG] Images and MS SQL Server

Dave

I thought you had code to save it?

To tretrieve it (rough I don't have )

ADOQuery.SQL.Add('SELECT FileCol FROM Table WHERE ID = 1');
ADOQuery.Open;
ADOQuery.FieldByName('FileCol ').SaveToFile(FileName);

FieldByName('FileCol ') should be a TBlobField

Neven



> I've struck a complete blank on this.
> Can anyone show me some code to save and load images from SQL Server
> using TADOQuery?
> The methods I've come up with don't appear to work at all...
>
> -Original Message-
> From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
> On Behalf Of Neven MacEwan
> Sent: Friday, 15 August 2008 4:02 p.m.
> To: NZ Borland Developers Group - Delphi List
> Subject: Re: [DUG] Images and MS SQL Server
>
> Dave
>
> Hasn't Tblobfield got the same streaming functions IIRC
>
>> I have worked out how to save an image into an Image field, but I'm
>> having brain fade on how to retrieve the image... Using TADOQuery,
>>
> D2005.
>
>> Save:
>>
>> ...
>>
>> datamod.ADOU.SQL.Add(':Image)') ;
>>
>> ms := TMemoryStream.Create ;
>>
>> try
>>
>> Image.Picture.Bitmap.SaveToStream(ms);
>>
>> ms.seek(0,0) ;
>>
>> datamod.ADOU.Parameters.ParamByName('Image').LoadFromStream(ms,
>> ftGraphic);
>>
>> finally
>>
>> ms.Free ;
>>
>> end ;
>>
>> datamod.ADOU.ExecSQL ;
>>
>> Anyone (I suppose everyone has) got a way to get the image back?
>>
>> Cheers,
>>
>> Dave.
>>
>>
>>
>

>
>> ___
>> NZ Borland Developers Group - Delphi mailing list
>> Post: delphi@delphi.org.nz
>> Admin: http://delphi.org.nz/mailman/listinfo/delphi
>> Unsubscribe: send an email to [EMAIL PROTECTED] with
>>
> Subject: unsubscribe
>
> ___
> NZ Borland Developers Group - Delphi mailing list
> Post: delphi@delphi.org.nz
> Admin: http://delphi.org.nz/mailman/listinfo/delphi
> Unsubscribe: send an email to [EMAIL PROTECTED] with
Subject:
> unsubscribe
>
> No virus found in this incoming message.
> Checked by AVG - http://www.avg.com
> Version: 8.0.138 / Virus Database: 270.6.4/1616 - Release Date:
> 16/08/2008 5:12 p.m.
>
> 

Re: [DUG] Images and MS SQL Server

2008-08-18 Thread Neven MacEwan
Dave

Im getting a little confused, have you or have you not managed to write 
an image to your DB?
You could confirm this with a simple sql query or crystal reports

If you have you should be able to open the table in the ide and bind a 
TDBImage to it

Neven
> That's exactly what I am doing to save the image, how do I retrieve it?
> Every method I have tried comes up blank.
>
> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> On Behalf Of Leigh Wanstead
> Sent: Monday, 18 August 2008 4:32 p.m.
> To: NZ Borland Developers Group - Delphi List
> Subject: Re: [DUG] Images and MS SQL Server
>
> IIRC, I will do this way.
>
>   varStream just a memory stream, you might want to instante with
> a
> TFileStream
>
>   ADOQueryTest.sql.text := 'UPDATE table SET FileCol =
> :FileColOBJECTS WHERE
> ID = :ID';
>   ...
>  
> ADOQueryTest.Parameters.ParamByName('FileColOBJECTS').LoadFromStream(v
> arStream, ftBlob);
>   ADOQueryTest.ExecSQL;
>
> Have a nice day
>
> Regards
> Leigh
> www.smootharm.com
>
>
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] Behalf Of Dave O'Brien
> Sent: Monday, 18 August 2008 4:17 p.m.
> To: NZ Borland Developers Group - Delphi List
> Subject: Re: [DUG] Images and MS SQL Server
>
>
> So did I, but I can't tell if it's not working because it's not saving
> or loading...
>
> The problem is FieldByName doesn't have any saveto... methods.
>
> I have tried to cast it as a Tblobfield
> (TBlobField(adoq.fieldbyname('Image')).Saveto...), but either this
> doesn't work or my save code doesn't work.
>
> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> On Behalf Of Neven MacEwan
> Sent: Monday, 18 August 2008 4:06 p.m.
> To: NZ Borland Developers Group - Delphi List
> Subject: Re: [DUG] Images and MS SQL Server
>
> Dave
>
> I thought you had code to save it?
>
> To tretrieve it (rough I don't have )
>
> ADOQuery.SQL.Add('SELECT FileCol FROM Table WHERE ID = 1');
> ADOQuery.Open;
> ADOQuery.FieldByName('FileCol ').SaveToFile(FileName);
>
> FieldByName('FileCol ') should be a TBlobField
>
> Neven
>
>
>
>   
>> I've struck a complete blank on this.
>> Can anyone show me some code to save and load images from SQL Server
>> using TADOQuery?
>> The methods I've come up with don't appear to work at all...
>>
>> -Original Message-
>> From: [EMAIL PROTECTED]
>> 
> [mailto:[EMAIL PROTECTED]
>   
>> On Behalf Of Neven MacEwan
>> Sent: Friday, 15 August 2008 4:02 p.m.
>> To: NZ Borland Developers Group - Delphi List
>> Subject: Re: [DUG] Images and MS SQL Server
>>
>> Dave
>>
>> Hasn't Tblobfield got the same streaming functions IIRC
>>
>> 
>>> I have worked out how to save an image into an Image field, but I'm
>>> having brain fade on how to retrieve the image... Using TADOQuery,
>>>
>>>   
>> D2005.
>>
>> 
>>> Save:
>>>
>>> ...
>>>
>>> datamod.ADOU.SQL.Add(':Image)') ;
>>>
>>> ms := TMemoryStream.Create ;
>>>
>>> try
>>>
>>> Image.Picture.Bitmap.SaveToStream(ms);
>>>
>>> ms.seek(0,0) ;
>>>
>>> datamod.ADOU.Parameters.ParamByName('Image').LoadFromStream(ms,
>>> ftGraphic);
>>>
>>> finally
>>>
>>> ms.Free ;
>>>
>>> end ;
>>>
>>> datamod.ADOU.ExecSQL ;
>>>
>>> Anyone (I suppose everyone has) got a way to get the image back?
>>>
>>> Cheers,
>>>
>>> Dave.
>>>
>>>
>>>
>>>   
> 
>   
>>> ___
>>> NZ Borland Developers Group - Delphi mailing list
>>> Post: delphi@delphi.org.nz
>>> Admin: http://delphi.org.nz/mailman/listinfo/delphi
>>> Unsubscribe: send an email to [EMAIL PROTECTED] with
>>>
>>>   
>> Subject: unsubscribe
>>
>> ___
>> NZ Borland Developers Group - Delphi mailing list
>> Post: delphi@delphi.org.nz
>> Admin: http://delphi.org.nz/mailman/listinfo/delphi
>> Unsubscribe: send an email to [EMAIL PROTECTED] with
>> 
> Subject:
>   
>> unsubscribe
&g

Re: [DUG] Images and MS SQL Server

2008-08-18 Thread Dave O'Brien
That's exactly what I am doing to save the image, how do I retrieve it?
Every method I have tried comes up blank.

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Leigh Wanstead
Sent: Monday, 18 August 2008 4:32 p.m.
To: NZ Borland Developers Group - Delphi List
Subject: Re: [DUG] Images and MS SQL Server

IIRC, I will do this way.

varStream just a memory stream, you might want to instante with
a
TFileStream

ADOQueryTest.sql.text := 'UPDATE table SET FileCol =
:FileColOBJECTS WHERE
ID = :ID';
...
 
ADOQueryTest.Parameters.ParamByName('FileColOBJECTS').LoadFromStream(v
arStream, ftBlob);
  ADOQueryTest.ExecSQL;

Have a nice day

Regards
Leigh
www.smootharm.com


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Dave O'Brien
Sent: Monday, 18 August 2008 4:17 p.m.
To: NZ Borland Developers Group - Delphi List
Subject: Re: [DUG] Images and MS SQL Server


So did I, but I can't tell if it's not working because it's not saving
or loading...

The problem is FieldByName doesn't have any saveto... methods.

I have tried to cast it as a Tblobfield
(TBlobField(adoq.fieldbyname('Image')).Saveto...), but either this
doesn't work or my save code doesn't work.

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Neven MacEwan
Sent: Monday, 18 August 2008 4:06 p.m.
To: NZ Borland Developers Group - Delphi List
Subject: Re: [DUG] Images and MS SQL Server

Dave

I thought you had code to save it?

To tretrieve it (rough I don't have )

ADOQuery.SQL.Add('SELECT FileCol FROM Table WHERE ID = 1');
ADOQuery.Open;
ADOQuery.FieldByName('FileCol ').SaveToFile(FileName);

FieldByName('FileCol ') should be a TBlobField

Neven



> I've struck a complete blank on this.
> Can anyone show me some code to save and load images from SQL Server
> using TADOQuery?
> The methods I've come up with don't appear to work at all...
>
> -Original Message-
> From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
> On Behalf Of Neven MacEwan
> Sent: Friday, 15 August 2008 4:02 p.m.
> To: NZ Borland Developers Group - Delphi List
> Subject: Re: [DUG] Images and MS SQL Server
>
> Dave
>
> Hasn't Tblobfield got the same streaming functions IIRC
>
>> I have worked out how to save an image into an Image field, but I'm
>> having brain fade on how to retrieve the image... Using TADOQuery,
>>
> D2005.
>
>> Save:
>>
>> ...
>>
>> datamod.ADOU.SQL.Add(':Image)') ;
>>
>> ms := TMemoryStream.Create ;
>>
>> try
>>
>> Image.Picture.Bitmap.SaveToStream(ms);
>>
>> ms.seek(0,0) ;
>>
>> datamod.ADOU.Parameters.ParamByName('Image').LoadFromStream(ms,
>> ftGraphic);
>>
>> finally
>>
>> ms.Free ;
>>
>> end ;
>>
>> datamod.ADOU.ExecSQL ;
>>
>> Anyone (I suppose everyone has) got a way to get the image back?
>>
>> Cheers,
>>
>> Dave.
>>
>>
>>
>

>
>> ___
>> NZ Borland Developers Group - Delphi mailing list
>> Post: delphi@delphi.org.nz
>> Admin: http://delphi.org.nz/mailman/listinfo/delphi
>> Unsubscribe: send an email to [EMAIL PROTECTED] with
>>
> Subject: unsubscribe
>
> ___
> NZ Borland Developers Group - Delphi mailing list
> Post: delphi@delphi.org.nz
> Admin: http://delphi.org.nz/mailman/listinfo/delphi
> Unsubscribe: send an email to [EMAIL PROTECTED] with
Subject:
> unsubscribe
>
> No virus found in this incoming message.
> Checked by AVG - http://www.avg.com
> Version: 8.0.138 / Virus Database: 270.6.4/1616 - Release Date:
> 16/08/2008 5:12 p.m.
>
> ___
> NZ Borland Developers Group - Delphi mailing list
> Post: delphi@delphi.org.nz
> Admin: http://delphi.org.nz/mailman/listinfo/delphi
> Unsubscribe: send an email to [EMAIL PROTECTED] with
Subject: unsubscribe
>
>
>

___
NZ Borland Developers Group - Delphi mailing list
Post: delphi@delphi.org.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to [EMAIL PROTECTED] with Subject:
unsubscribe

No virus found in this incoming message.
Checked by AVG - http://www.avg.com
Version: 8.0.138 / Virus Database: 270.6.4/1617 - Release Date:
17/08/2008 12:58 p.m.

___
NZ Borland Developers Group - Delphi mailing list
Post: delphi@delphi.org.nz

Re: [DUG] Images and MS SQL Server

2008-08-17 Thread Dave O'Brien
If I put a TADOTable on the form and populate it, the Image field is
ftBlob.

The MSSQL datatype is "Image".

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Neven MacEwan
Sent: Monday, 18 August 2008 4:25 p.m.
To: NZ Borland Developers Group - Delphi List
Subject: Re: [DUG] Images and MS SQL Server

Dave
 

Have you used the IDE interactively to open the query and check the type

of field created?
I use ADO (but my delphi system is down right now) so i'll have a look

What is your MSSQL Datatype?

FieldByName would return a tfield (which you have to cast)



N

> So did I, but I can't tell if it's not working because it's not saving
> or loading...
>
> The problem is FieldByName doesn't have any saveto... methods. 
>
> I have tried to cast it as a Tblobfield
> (TBlobField(adoq.fieldbyname('Image')).Saveto...), but either this
> doesn't work or my save code doesn't work.
>
> -Original Message-
> From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
> On Behalf Of Neven MacEwan
> Sent: Monday, 18 August 2008 4:06 p.m.
> To: NZ Borland Developers Group - Delphi List
> Subject: Re: [DUG] Images and MS SQL Server
>
> Dave
>
> I thought you had code to save it?
>
> To tretrieve it (rough I don't have )
>
> ADOQuery.SQL.Add('SELECT FileCol FROM Table WHERE ID = 1');
> ADOQuery.Open;
> ADOQuery.FieldByName('FileCol ').SaveToFile(FileName);
>
> FieldByName('FileCol ') should be a TBlobField
>
> Neven
>
>
>
>   
>> I've struck a complete blank on this.
>> Can anyone show me some code to save and load images from SQL Server
>> using TADOQuery?
>> The methods I've come up with don't appear to work at all...
>>
>> -Original Message-
>> From: [EMAIL PROTECTED]
>> 
> [mailto:[EMAIL PROTECTED]
>   
>> On Behalf Of Neven MacEwan
>> Sent: Friday, 15 August 2008 4:02 p.m.
>> To: NZ Borland Developers Group - Delphi List
>> Subject: Re: [DUG] Images and MS SQL Server
>>
>> Dave
>>
>> Hasn't Tblobfield got the same streaming functions IIRC
>>   
>> 
>>> I have worked out how to save an image into an Image field, but I'm 
>>> having brain fade on how to retrieve the image... Using TADOQuery,
>>> 
>>>   
>> D2005.
>>   
>> 
>>> Save:
>>>
>>> ...
>>>
>>> datamod.ADOU.SQL.Add(':Image)') ;
>>>
>>> ms := TMemoryStream.Create ;
>>>
>>> try
>>>
>>> Image.Picture.Bitmap.SaveToStream(ms);
>>>
>>> ms.seek(0,0) ;
>>>
>>> datamod.ADOU.Parameters.ParamByName('Image').LoadFromStream(ms, 
>>> ftGraphic);
>>>
>>> finally
>>>
>>> ms.Free ;
>>>
>>> end ;
>>>
>>> datamod.ADOU.ExecSQL ;
>>>
>>> Anyone (I suppose everyone has) got a way to get the image back?
>>>
>>> Cheers,
>>>
>>> Dave.
>>>
>>>
>>> 
>>>   
>

>   
>>   
>> 
>>> ___
>>> NZ Borland Developers Group - Delphi mailing list
>>> Post: delphi@delphi.org.nz
>>> Admin: http://delphi.org.nz/mailman/listinfo/delphi
>>> Unsubscribe: send an email to [EMAIL PROTECTED] with
>>> 
>>>   
>> Subject: unsubscribe
>>
>> ___
>> NZ Borland Developers Group - Delphi mailing list
>> Post: delphi@delphi.org.nz
>> Admin: http://delphi.org.nz/mailman/listinfo/delphi
>> Unsubscribe: send an email to [EMAIL PROTECTED] with
>> 
> Subject:
>   
>> unsubscribe
>>
>> No virus found in this incoming message.
>> Checked by AVG - http://www.avg.com 
>> Version: 8.0.138 / Virus Database: 270.6.4/1616 - Release Date:
>> 16/08/2008 5:12 p.m.
>>
>> ___
>> NZ Borland Developers Group - Delphi mailing list
>> Post: delphi@delphi.org.nz
>> Admin: http://delphi.org.nz/mailman/listinfo/delphi
>> Unsubscribe: send an email to [EMAIL PROTECTED] with
>> 
> Subject: unsubscribe
>   
>>   
>> 
>
> ___
> NZ Borland Developers Group - Delphi mailing list
> Post: delphi@delphi.org.nz
> Admin: http://delphi.org.nz/mailman/l

Re: [DUG] Images and MS SQL Server

2008-08-17 Thread Leigh Wanstead
IIRC, I will do this way.

varStream just a memory stream, you might want to instante with a
TFileStream

ADOQueryTest.sql.text := 'UPDATE table SET FileCol = :FileColOBJECTS 
WHERE
ID = :ID';
...
  ADOQueryTest.Parameters.ParamByName('FileColOBJECTS').LoadFromStream(v
arStream, ftBlob);
  ADOQueryTest.ExecSQL;

Have a nice day

Regards
Leigh
www.smootharm.com


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Dave O'Brien
Sent: Monday, 18 August 2008 4:17 p.m.
To: NZ Borland Developers Group - Delphi List
Subject: Re: [DUG] Images and MS SQL Server


So did I, but I can't tell if it's not working because it's not saving
or loading...

The problem is FieldByName doesn't have any saveto... methods.

I have tried to cast it as a Tblobfield
(TBlobField(adoq.fieldbyname('Image')).Saveto...), but either this
doesn't work or my save code doesn't work.

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Neven MacEwan
Sent: Monday, 18 August 2008 4:06 p.m.
To: NZ Borland Developers Group - Delphi List
Subject: Re: [DUG] Images and MS SQL Server

Dave

I thought you had code to save it?

To tretrieve it (rough I don't have )

ADOQuery.SQL.Add('SELECT FileCol FROM Table WHERE ID = 1');
ADOQuery.Open;
ADOQuery.FieldByName('FileCol ').SaveToFile(FileName);

FieldByName('FileCol ') should be a TBlobField

Neven



> I've struck a complete blank on this.
> Can anyone show me some code to save and load images from SQL Server
> using TADOQuery?
> The methods I've come up with don't appear to work at all...
>
> -Original Message-
> From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
> On Behalf Of Neven MacEwan
> Sent: Friday, 15 August 2008 4:02 p.m.
> To: NZ Borland Developers Group - Delphi List
> Subject: Re: [DUG] Images and MS SQL Server
>
> Dave
>
> Hasn't Tblobfield got the same streaming functions IIRC
>
>> I have worked out how to save an image into an Image field, but I'm
>> having brain fade on how to retrieve the image... Using TADOQuery,
>>
> D2005.
>
>> Save:
>>
>> ...
>>
>> datamod.ADOU.SQL.Add(':Image)') ;
>>
>> ms := TMemoryStream.Create ;
>>
>> try
>>
>> Image.Picture.Bitmap.SaveToStream(ms);
>>
>> ms.seek(0,0) ;
>>
>> datamod.ADOU.Parameters.ParamByName('Image').LoadFromStream(ms,
>> ftGraphic);
>>
>> finally
>>
>> ms.Free ;
>>
>> end ;
>>
>> datamod.ADOU.ExecSQL ;
>>
>> Anyone (I suppose everyone has) got a way to get the image back?
>>
>> Cheers,
>>
>> Dave.
>>
>>
>>
>

>
>> ___
>> NZ Borland Developers Group - Delphi mailing list
>> Post: delphi@delphi.org.nz
>> Admin: http://delphi.org.nz/mailman/listinfo/delphi
>> Unsubscribe: send an email to [EMAIL PROTECTED] with
>>
> Subject: unsubscribe
>
> ___
> NZ Borland Developers Group - Delphi mailing list
> Post: delphi@delphi.org.nz
> Admin: http://delphi.org.nz/mailman/listinfo/delphi
> Unsubscribe: send an email to [EMAIL PROTECTED] with
Subject:
> unsubscribe
>
> No virus found in this incoming message.
> Checked by AVG - http://www.avg.com
> Version: 8.0.138 / Virus Database: 270.6.4/1616 - Release Date:
> 16/08/2008 5:12 p.m.
>
> ___
> NZ Borland Developers Group - Delphi mailing list
> Post: delphi@delphi.org.nz
> Admin: http://delphi.org.nz/mailman/listinfo/delphi
> Unsubscribe: send an email to [EMAIL PROTECTED] with
Subject: unsubscribe
>
>
>

___
NZ Borland Developers Group - Delphi mailing list
Post: delphi@delphi.org.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to [EMAIL PROTECTED] with Subject:
unsubscribe

No virus found in this incoming message.
Checked by AVG - http://www.avg.com
Version: 8.0.138 / Virus Database: 270.6.4/1617 - Release Date:
17/08/2008 12:58 p.m.

___
NZ Borland Developers Group - Delphi mailing list
Post: delphi@delphi.org.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to [EMAIL PROTECTED] with Subject:
unsubscribe


___
NZ Borland Developers Group - Delphi mailing list
Post: delphi@delphi.org.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to [EMAIL PROTECTED] with Subject: unsubscribe


Re: [DUG] Images and MS SQL Server

2008-08-17 Thread Neven MacEwan
Dave
 

Have you used the IDE interactively to open the query and check the type 
of field created?
I use ADO (but my delphi system is down right now) so i'll have a look

What is your MSSQL Datatype?

FieldByName would return a tfield (which you have to cast)



N

> So did I, but I can't tell if it's not working because it's not saving
> or loading...
>
> The problem is FieldByName doesn't have any saveto... methods. 
>
> I have tried to cast it as a Tblobfield
> (TBlobField(adoq.fieldbyname('Image')).Saveto...), but either this
> doesn't work or my save code doesn't work.
>
> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> On Behalf Of Neven MacEwan
> Sent: Monday, 18 August 2008 4:06 p.m.
> To: NZ Borland Developers Group - Delphi List
> Subject: Re: [DUG] Images and MS SQL Server
>
> Dave
>
> I thought you had code to save it?
>
> To tretrieve it (rough I don't have )
>
> ADOQuery.SQL.Add('SELECT FileCol FROM Table WHERE ID = 1');
> ADOQuery.Open;
> ADOQuery.FieldByName('FileCol ').SaveToFile(FileName);
>
> FieldByName('FileCol ') should be a TBlobField
>
> Neven
>
>
>
>   
>> I've struck a complete blank on this.
>> Can anyone show me some code to save and load images from SQL Server
>> using TADOQuery?
>> The methods I've come up with don't appear to work at all...
>>
>> -----Original Message-
>> From: [EMAIL PROTECTED]
>> 
> [mailto:[EMAIL PROTECTED]
>   
>> On Behalf Of Neven MacEwan
>> Sent: Friday, 15 August 2008 4:02 p.m.
>> To: NZ Borland Developers Group - Delphi List
>> Subject: Re: [DUG] Images and MS SQL Server
>>
>> Dave
>>
>> Hasn't Tblobfield got the same streaming functions IIRC
>>   
>> 
>>> I have worked out how to save an image into an Image field, but I'm 
>>> having brain fade on how to retrieve the image... Using TADOQuery,
>>> 
>>>   
>> D2005.
>>   
>> 
>>> Save:
>>>
>>> ...
>>>
>>> datamod.ADOU.SQL.Add(':Image)') ;
>>>
>>> ms := TMemoryStream.Create ;
>>>
>>> try
>>>
>>> Image.Picture.Bitmap.SaveToStream(ms);
>>>
>>> ms.seek(0,0) ;
>>>
>>> datamod.ADOU.Parameters.ParamByName('Image').LoadFromStream(ms, 
>>> ftGraphic);
>>>
>>> finally
>>>
>>> ms.Free ;
>>>
>>> end ;
>>>
>>> datamod.ADOU.ExecSQL ;
>>>
>>> Anyone (I suppose everyone has) got a way to get the image back?
>>>
>>> Cheers,
>>>
>>> Dave.
>>>
>>>
>>> 
>>>   
> 
>   
>>   
>> 
>>> ___
>>> NZ Borland Developers Group - Delphi mailing list
>>> Post: delphi@delphi.org.nz
>>> Admin: http://delphi.org.nz/mailman/listinfo/delphi
>>> Unsubscribe: send an email to [EMAIL PROTECTED] with
>>> 
>>>   
>> Subject: unsubscribe
>>
>> ___
>> NZ Borland Developers Group - Delphi mailing list
>> Post: delphi@delphi.org.nz
>> Admin: http://delphi.org.nz/mailman/listinfo/delphi
>> Unsubscribe: send an email to [EMAIL PROTECTED] with
>> 
> Subject:
>   
>> unsubscribe
>>
>> No virus found in this incoming message.
>> Checked by AVG - http://www.avg.com 
>> Version: 8.0.138 / Virus Database: 270.6.4/1616 - Release Date:
>> 16/08/2008 5:12 p.m.
>>
>> ___
>> NZ Borland Developers Group - Delphi mailing list
>> Post: delphi@delphi.org.nz
>> Admin: http://delphi.org.nz/mailman/listinfo/delphi
>> Unsubscribe: send an email to [EMAIL PROTECTED] with
>> 
> Subject: unsubscribe
>   
>>   
>> 
>
> ___
> NZ Borland Developers Group - Delphi mailing list
> Post: delphi@delphi.org.nz
> Admin: http://delphi.org.nz/mailman/listinfo/delphi
> Unsubscribe: send an email to [EMAIL PROTECTED] with Subject:
> unsubscribe
>
> No virus found in this incoming message.
> Checked by AVG - http://www.avg.com 
> Version: 8.0.138 / Virus Database: 270.6.4/1617 - Release Date:
> 17/08/2008 12:58 p.m.
>
> ___
> NZ Borland Developers Group - Delphi mailing list
> Post: delphi@delphi.org.nz
> Admin: http://delphi.org.nz/mailman/listinfo/delphi
> Unsubscribe: send an email to [EMAIL PROTECTED] with Subject: unsubscribe
>
>
>   

___
NZ Borland Developers Group - Delphi mailing list
Post: delphi@delphi.org.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to [EMAIL PROTECTED] with Subject: unsubscribe


Re: [DUG] Images and MS SQL Server

2008-08-17 Thread Robert martin
Might not help (not ADO componenets) but none the less.

//Loading image (file) into DB

FileStream 
:=TFileStream.Create(zClientsDM.OpenPictureDialog.FileName ,fmOpenRead 
or fmShareDenyNone);
try
with DataSet do begin
CreateBlobStream(FieldByName('Fieldname 
here'), bmReadWrite).CopyFrom(FileStream,0);
...
end;
finally
FileStream.Free;
end;


//Saving out of DB to file

Stream := 
DataSet.CreateBlobStream(DataSet.FieldByName('Field name here'), bmRead);
try
FileStream := TFileStream.Create(FileName, 
fmCreate);
try
FileStream.CopyFrom(Stream, 0);
finally
FileStream.Free;
end;
finally
Stream.Free;
end;

Hope thats of some use :)

Note : cut and paste but with some extras removed.

Rob

Dave O'Brien wrote:
> I've struck a complete blank on this.
> Can anyone show me some code to save and load images from SQL Server
> using TADOQuery?
> The methods I've come up with don't appear to work at all...
>
> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> On Behalf Of Neven MacEwan
> Sent: Friday, 15 August 2008 4:02 p.m.
> To: NZ Borland Developers Group - Delphi List
> Subject: Re: [DUG] Images and MS SQL Server
>
> Dave
>
> Hasn't Tblobfield got the same streaming functions IIRC
>   
>> I have worked out how to save an image into an Image field, but I'm 
>> having brain fade on how to retrieve the image... Using TADOQuery,
>> 
> D2005.
>   
>> Save:
>>
>> ...
>>
>> datamod.ADOU.SQL.Add(':Image)') ;
>>
>> ms := TMemoryStream.Create ;
>>
>> try
>>
>> Image.Picture.Bitmap.SaveToStream(ms);
>>
>> ms.seek(0,0) ;
>>
>> datamod.ADOU.Parameters.ParamByName('Image').LoadFromStream(ms, 
>> ftGraphic);
>>
>> finally
>>
>> ms.Free ;
>>
>> end ;
>>
>> datamod.ADOU.ExecSQL ;
>>
>> Anyone (I suppose everyone has) got a way to get the image back?
>>
>> Cheers,
>>
>> Dave.
>>
>>
>> 
> 
>   
>> ___
>> NZ Borland Developers Group - Delphi mailing list
>> Post: delphi@delphi.org.nz
>> Admin: http://delphi.org.nz/mailman/listinfo/delphi
>> Unsubscribe: send an email to [EMAIL PROTECTED] with
>> 
> Subject: unsubscribe
>
> ___
> NZ Borland Developers Group - Delphi mailing list
> Post: delphi@delphi.org.nz
> Admin: http://delphi.org.nz/mailman/listinfo/delphi
> Unsubscribe: send an email to [EMAIL PROTECTED] with Subject:
> unsubscribe
>
> No virus found in this incoming message.
> Checked by AVG - http://www.avg.com 
> Version: 8.0.138 / Virus Database: 270.6.4/1616 - Release Date:
> 16/08/2008 5:12 p.m.
>
> ___
> NZ Borland Developers Group - Delphi mailing list
> Post: delphi@delphi.org.nz
> Admin: http://delphi.org.nz/mailman/listinfo/delphi
> Unsubscribe: send an email to [EMAIL PROTECTED] with Subject: unsubscribe
>
>   
___
NZ Borland Developers Group - Delphi mailing list
Post: delphi@delphi.org.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to [EMAIL PROTECTED] with Subject: unsubscribe


Re: [DUG] Images and MS SQL Server

2008-08-17 Thread Dave O'Brien
So did I, but I can't tell if it's not working because it's not saving
or loading...

The problem is FieldByName doesn't have any saveto... methods. 

I have tried to cast it as a Tblobfield
(TBlobField(adoq.fieldbyname('Image')).Saveto...), but either this
doesn't work or my save code doesn't work.

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Neven MacEwan
Sent: Monday, 18 August 2008 4:06 p.m.
To: NZ Borland Developers Group - Delphi List
Subject: Re: [DUG] Images and MS SQL Server

Dave

I thought you had code to save it?

To tretrieve it (rough I don't have )

ADOQuery.SQL.Add('SELECT FileCol FROM Table WHERE ID = 1');
ADOQuery.Open;
ADOQuery.FieldByName('FileCol ').SaveToFile(FileName);

FieldByName('FileCol ') should be a TBlobField

Neven



> I've struck a complete blank on this.
> Can anyone show me some code to save and load images from SQL Server
> using TADOQuery?
> The methods I've come up with don't appear to work at all...
>
> -Original Message-
> From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
> On Behalf Of Neven MacEwan
> Sent: Friday, 15 August 2008 4:02 p.m.
> To: NZ Borland Developers Group - Delphi List
> Subject: Re: [DUG] Images and MS SQL Server
>
> Dave
>
> Hasn't Tblobfield got the same streaming functions IIRC
>   
>> I have worked out how to save an image into an Image field, but I'm 
>> having brain fade on how to retrieve the image... Using TADOQuery,
>> 
> D2005.
>   
>> Save:
>>
>> ...
>>
>> datamod.ADOU.SQL.Add(':Image)') ;
>>
>> ms := TMemoryStream.Create ;
>>
>> try
>>
>> Image.Picture.Bitmap.SaveToStream(ms);
>>
>> ms.seek(0,0) ;
>>
>> datamod.ADOU.Parameters.ParamByName('Image').LoadFromStream(ms, 
>> ftGraphic);
>>
>> finally
>>
>> ms.Free ;
>>
>> end ;
>>
>> datamod.ADOU.ExecSQL ;
>>
>> Anyone (I suppose everyone has) got a way to get the image back?
>>
>> Cheers,
>>
>> Dave.
>>
>>
>> 
>

>   
>> ___
>> NZ Borland Developers Group - Delphi mailing list
>> Post: delphi@delphi.org.nz
>> Admin: http://delphi.org.nz/mailman/listinfo/delphi
>> Unsubscribe: send an email to [EMAIL PROTECTED] with
>> 
> Subject: unsubscribe
>
> ___
> NZ Borland Developers Group - Delphi mailing list
> Post: delphi@delphi.org.nz
> Admin: http://delphi.org.nz/mailman/listinfo/delphi
> Unsubscribe: send an email to [EMAIL PROTECTED] with
Subject:
> unsubscribe
>
> No virus found in this incoming message.
> Checked by AVG - http://www.avg.com 
> Version: 8.0.138 / Virus Database: 270.6.4/1616 - Release Date:
> 16/08/2008 5:12 p.m.
>
> ___
> NZ Borland Developers Group - Delphi mailing list
> Post: delphi@delphi.org.nz
> Admin: http://delphi.org.nz/mailman/listinfo/delphi
> Unsubscribe: send an email to [EMAIL PROTECTED] with
Subject: unsubscribe
>
>
>   

___
NZ Borland Developers Group - Delphi mailing list
Post: delphi@delphi.org.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to [EMAIL PROTECTED] with Subject:
unsubscribe

No virus found in this incoming message.
Checked by AVG - http://www.avg.com 
Version: 8.0.138 / Virus Database: 270.6.4/1617 - Release Date:
17/08/2008 12:58 p.m.

___
NZ Borland Developers Group - Delphi mailing list
Post: delphi@delphi.org.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to [EMAIL PROTECTED] with Subject: unsubscribe


Re: [DUG] Images and MS SQL Server

2008-08-17 Thread Neven MacEwan
Dave

I thought you had code to save it?

To tretrieve it (rough I don't have )

ADOQuery.SQL.Add('SELECT FileCol FROM Table WHERE ID = 1');
ADOQuery.Open;
ADOQuery.FieldByName('FileCol ').SaveToFile(FileName);

FieldByName('FileCol ') should be a TBlobField

Neven



> I've struck a complete blank on this.
> Can anyone show me some code to save and load images from SQL Server
> using TADOQuery?
> The methods I've come up with don't appear to work at all...
>
> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> On Behalf Of Neven MacEwan
> Sent: Friday, 15 August 2008 4:02 p.m.
> To: NZ Borland Developers Group - Delphi List
> Subject: Re: [DUG] Images and MS SQL Server
>
> Dave
>
> Hasn't Tblobfield got the same streaming functions IIRC
>   
>> I have worked out how to save an image into an Image field, but I'm 
>> having brain fade on how to retrieve the image... Using TADOQuery,
>> 
> D2005.
>   
>> Save:
>>
>> ...
>>
>> datamod.ADOU.SQL.Add(':Image)') ;
>>
>> ms := TMemoryStream.Create ;
>>
>> try
>>
>> Image.Picture.Bitmap.SaveToStream(ms);
>>
>> ms.seek(0,0) ;
>>
>> datamod.ADOU.Parameters.ParamByName('Image').LoadFromStream(ms, 
>> ftGraphic);
>>
>> finally
>>
>> ms.Free ;
>>
>> end ;
>>
>> datamod.ADOU.ExecSQL ;
>>
>> Anyone (I suppose everyone has) got a way to get the image back?
>>
>> Cheers,
>>
>> Dave.
>>
>>
>> 
> 
>   
>> ___
>> NZ Borland Developers Group - Delphi mailing list
>> Post: delphi@delphi.org.nz
>> Admin: http://delphi.org.nz/mailman/listinfo/delphi
>> Unsubscribe: send an email to [EMAIL PROTECTED] with
>> 
> Subject: unsubscribe
>
> ___
> NZ Borland Developers Group - Delphi mailing list
> Post: delphi@delphi.org.nz
> Admin: http://delphi.org.nz/mailman/listinfo/delphi
> Unsubscribe: send an email to [EMAIL PROTECTED] with Subject:
> unsubscribe
>
> No virus found in this incoming message.
> Checked by AVG - http://www.avg.com 
> Version: 8.0.138 / Virus Database: 270.6.4/1616 - Release Date:
> 16/08/2008 5:12 p.m.
>
> ___
> NZ Borland Developers Group - Delphi mailing list
> Post: delphi@delphi.org.nz
> Admin: http://delphi.org.nz/mailman/listinfo/delphi
> Unsubscribe: send an email to [EMAIL PROTECTED] with Subject: unsubscribe
>
>
>   

___
NZ Borland Developers Group - Delphi mailing list
Post: delphi@delphi.org.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to [EMAIL PROTECTED] with Subject: unsubscribe


Re: [DUG] Images and MS SQL Server

2008-08-17 Thread Dave O'Brien
I've struck a complete blank on this.
Can anyone show me some code to save and load images from SQL Server
using TADOQuery?
The methods I've come up with don't appear to work at all...

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Neven MacEwan
Sent: Friday, 15 August 2008 4:02 p.m.
To: NZ Borland Developers Group - Delphi List
Subject: Re: [DUG] Images and MS SQL Server

Dave

Hasn't Tblobfield got the same streaming functions IIRC
>
> I have worked out how to save an image into an Image field, but I'm 
> having brain fade on how to retrieve the image... Using TADOQuery,
D2005.
>
> Save:
>
> ...
>
> datamod.ADOU.SQL.Add(':Image)') ;
>
> ms := TMemoryStream.Create ;
>
> try
>
> Image.Picture.Bitmap.SaveToStream(ms);
>
> ms.seek(0,0) ;
>
> datamod.ADOU.Parameters.ParamByName('Image').LoadFromStream(ms, 
> ftGraphic);
>
> finally
>
> ms.Free ;
>
> end ;
>
> datamod.ADOU.ExecSQL ;
>
> Anyone (I suppose everyone has) got a way to get the image back?
>
> Cheers,
>
> Dave.
>
>

>
> ___
> NZ Borland Developers Group - Delphi mailing list
> Post: delphi@delphi.org.nz
> Admin: http://delphi.org.nz/mailman/listinfo/delphi
> Unsubscribe: send an email to [EMAIL PROTECTED] with
Subject: unsubscribe

___
NZ Borland Developers Group - Delphi mailing list
Post: delphi@delphi.org.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to [EMAIL PROTECTED] with Subject:
unsubscribe

No virus found in this incoming message.
Checked by AVG - http://www.avg.com 
Version: 8.0.138 / Virus Database: 270.6.4/1616 - Release Date:
16/08/2008 5:12 p.m.

___
NZ Borland Developers Group - Delphi mailing list
Post: delphi@delphi.org.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to [EMAIL PROTECTED] with Subject: unsubscribe


Re: [DUG] Images and MS SQL Server

2008-08-14 Thread Neven MacEwan
Dave

Hasn't Tblobfield got the same streaming functions IIRC
>
> I have worked out how to save an image into an Image field, but I’m 
> having brain fade on how to retrieve the image... Using TADOQuery, D2005.
>
> Save:
>
> ...
>
> datamod.ADOU.SQL.Add(':Image)') ;
>
> ms := TMemoryStream.Create ;
>
> try
>
> Image.Picture.Bitmap.SaveToStream(ms);
>
> ms.seek(0,0) ;
>
> datamod.ADOU.Parameters.ParamByName('Image').LoadFromStream(ms, 
> ftGraphic);
>
> finally
>
> ms.Free ;
>
> end ;
>
> datamod.ADOU.ExecSQL ;
>
> Anyone (I suppose everyone has) got a way to get the image back?
>
> Cheers,
>
> Dave.
>
> 
>
> ___
> NZ Borland Developers Group - Delphi mailing list
> Post: delphi@delphi.org.nz
> Admin: http://delphi.org.nz/mailman/listinfo/delphi
> Unsubscribe: send an email to [EMAIL PROTECTED] with Subject: unsubscribe

___
NZ Borland Developers Group - Delphi mailing list
Post: delphi@delphi.org.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to [EMAIL PROTECTED] with Subject: unsubscribe


Re: [DUG]: Images on MDI parents

1999-10-20 Thread Rohit Gupta

STeven,

I made my own component to do that, would you like a copy ?

On 18 Oct 99 at 8:24, Steven Wild wrote:

> 
> We want to put an image onto a MDI parent form that will not show 
> through overlaid child forms in the way visible components on 
> parent forms do.  (I just need a graphic background for an app.)
> 
> So far I have discovered that TImage on a parent forms shows 
> nothing at all.
> 
> How do I achieve my goal.
> 
> Steven
> Steven Wild
> Director
> Wild Software Ltd
> P O Box 33-216
> Christchurch, NZ
> Ph & Fax  64 3 377-0495
> ___
> 
> Chreos Business Systems
> ___
> ---
> New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
>   Website: http://www.delphi.org.nz
> 
Rohit

==
CFL - Computer Fanatics Ltd.  21 Barry's Point Road, AKL, New Zealand
PH(649) 489-2280 
FX(649) 489-2290
email [EMAIL PROTECTED]  or  [EMAIL PROTECTED]
==

---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz



RE: [DUG]: Images

1999-09-06 Thread Chris Crowe

Paint the rest of the client area.

Procedure  .Paint;
begin
  FillRect(ClientRect);
  DOTextDrawing;
end;

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
Behalf Of [EMAIL PROTECTED]
Sent: Wednesday, September 08, 1999 2:27 AM
To: Multiple recipients of list delphi
Subject: [DUG]: Images


Not sure my original email got thro, so here it is again :-

Hi all.

I was just playing with rotating text on an image controls canvas, when I
noticed that if I rotated the text by incrementing the angle by 45 deg. at a
time via a spin button, i.e. the rotation value was dynamic and it drew the
text at that angle at run time. if left the presence of the the text
from the previous angle there.

How do I sipt this from happening...I have an image i the Image controll
too,

Any Ideas ?

Thanks

Jeremy Coulter



Jeremy Coulter (chief software engineer)
Visual Software Solutions
Christchurch, New Zealand
PH 03-3521595
FAX 03-3521596
MOBILE 021-2150435
www.vss.co.nz


---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz

---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz



RE: [DUG]: Images

1999-02-14 Thread Patrick Dunford

What is a gp4?

Raize have a new TRzBackground but not enough information or demo version
yet available to determine what it can do.

> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
> Behalf Of Steven Wild
> Sent: Monday, 15 February 1999 21:23
> To: Multiple recipients of list Delphi
> Subject: Re: [DUG]: Images
>
>
> Anyone able to help on this one?
>
> Steven


Patrick Dunford, ChristChurch, NZ
http://patrick.dunford.com/

---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz



Re: [DUG]: Images

1999-02-14 Thread Steven Wild

Anyone able to help on this one?

Steven


> Thanks, I'll enquire but my client already has a viewer now.  
> However they want under certain circumstances to be able to view the 
> image as a panel on their Delphi app.  That is what i am looking for.
> 
> Steven 
> 
> 
> > To:Multiple recipients of list Delphi 
> <[EMAIL PROTECTED]>
> > Reply-to:  [EMAIL PROTECTED]
> > Date:  Sun, 07 Feb 1999 19:16:33 +1300
> > From:      Chris Chambers <[EMAIL PROTECTED]>
> > Subject:   Re: [DUG]:  Images
> 
> > A while back when I last looked the most expensive (but not too bad if you
> > really needed it) and by far the most robust application for viewing many
> > formats and the technical drawings of very large file size etc. was the
> > Canadian product Imagenation.  This was fully OLE 2 client and server before
> > some MS Office apps.  I am sure they must do an ActiveX solution by now.  The
> > company was called Spicer and the product was Imagenation.  If you must get a
> > result and want something that really performs this would be a good bet.
> > 
> > Steven Wild wrote:
> > 
> > > I am involved in software development that uses a viewing program to
> > > display .gp4 images of technical drawings.  We have seen that a
> > > number of packages will load these images but is there a component
> > > that will allow me to load them onto a form?
> > >
> > > Alternatively can I associate another application with one of my
> > > forms so that it only ever appears to run within the constrains of
> > > that form?
> > >
> > > Steven
> > >
> > > Wild Software Ltd
> > > P O Box 33-216
> > > Christchurch
> > > NEW ZEALAND
> > >
> > > =
> > > I haven't lost my mind; it's backed up on tape somewhere.
> > > =
> > > ---
> > > New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
> > >   Website: http://www.delphi.org.nz
> > 
> > ---
> > New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
> >   Website: http://www.delphi.org.nz
> > 
> > 
> 
> 
> Wild Software Ltd
> P O Box 33-216
> Christchurch
> NEW ZEALAND
> 
> =
> I haven't lost my mind; it's backed up on tape somewhere.
> =
> ---
> New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
>   Website: http://www.delphi.org.nz
> 
> 


Wild Software Ltd
P O Box 33-216
Christchurch
NEW ZEALAND

=
I haven't lost my mind; it's backed up on tape somewhere.
=
---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz



Re: [DUG]: Images

1999-02-07 Thread Steven Wild

Thanks, I'll enquire but my client already has a viewer now.  
However they want under certain circumstances to be able to view the 
image as a panel on their Delphi app.  That is what i am looking for.

Steven 


> To:Multiple recipients of list Delphi 
<[EMAIL PROTECTED]>
> Reply-to:  [EMAIL PROTECTED]
> Date:  Sun, 07 Feb 1999 19:16:33 +1300
> From:  Chris Chambers <[EMAIL PROTECTED]>
> Subject:   Re: [DUG]:  Images

> A while back when I last looked the most expensive (but not too bad if you
> really needed it) and by far the most robust application for viewing many
> formats and the technical drawings of very large file size etc. was the
> Canadian product Imagenation.  This was fully OLE 2 client and server before
> some MS Office apps.  I am sure they must do an ActiveX solution by now.  The
> company was called Spicer and the product was Imagenation.  If you must get a
> result and want something that really performs this would be a good bet.
> 
> Steven Wild wrote:
> 
> > I am involved in software development that uses a viewing program to
> > display .gp4 images of technical drawings.  We have seen that a
> > number of packages will load these images but is there a component
> > that will allow me to load them onto a form?
> >
> > Alternatively can I associate another application with one of my
> > forms so that it only ever appears to run within the constrains of
> > that form?
> >
> > Steven
> >
> > Wild Software Ltd
> > P O Box 33-216
> > Christchurch
> > NEW ZEALAND
> >
> > =
> > I haven't lost my mind; it's backed up on tape somewhere.
> > =
> > ---
> > New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
> >   Website: http://www.delphi.org.nz
> 
> ---
> New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
>   Website: http://www.delphi.org.nz
> 
> 


Wild Software Ltd
P O Box 33-216
Christchurch
NEW ZEALAND

=
I haven't lost my mind; it's backed up on tape somewhere.
=
---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz



Re: [DUG]: Images

1999-02-07 Thread Chris Chambers

A while back when I last looked the most expensive (but not too bad if you
really needed it) and by far the most robust application for viewing many
formats and the technical drawings of very large file size etc. was the
Canadian product Imagenation.  This was fully OLE 2 client and server before
some MS Office apps.  I am sure they must do an ActiveX solution by now.  The
company was called Spicer and the product was Imagenation.  If you must get a
result and want something that really performs this would be a good bet.

Steven Wild wrote:

> I am involved in software development that uses a viewing program to
> display .gp4 images of technical drawings.  We have seen that a
> number of packages will load these images but is there a component
> that will allow me to load them onto a form?
>
> Alternatively can I associate another application with one of my
> forms so that it only ever appears to run within the constrains of
> that form?
>
> Steven
>
> Wild Software Ltd
> P O Box 33-216
> Christchurch
> NEW ZEALAND
>
> =
> I haven't lost my mind; it's backed up on tape somewhere.
> =
> ---
> New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
>   Website: http://www.delphi.org.nz

---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz