home *** CD-ROM | disk | FTP | other *** search
/ Delphi Anthology / aDELPHI.iso / Runimage / Delphi50 / Demos / Midas / InternetExpress / InetXCenter / readfileclientdataset.pas < prev    next >
Pascal/Delphi Source File  |  1999-08-11  |  1KB  |  58 lines

  1.  
  2. {
  3.   InternetExpress sample component.
  4.  
  5.   TReadFileClientDataSet is a custom TClientDataSet that
  6.   does not write the client data set file to disk when the
  7.   data set is closed.  The inetxcenter sample application
  8.   uses a client data set file for read only data.
  9.  
  10. }
  11. unit ReadFileClientDataSet;
  12.  
  13. interface
  14.  
  15. uses
  16.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  17.   Db, DBClient;
  18.  
  19. type
  20.   TReadFileClientDataSet = class(TClientDataSet)
  21.   private
  22.     { Private declarations }
  23.   protected
  24.     { Protected declarations }
  25.     procedure CloseCursor; override;
  26.   public
  27.     { Public declarations }
  28.   published
  29.     { Published declarations }
  30.   end;
  31.  
  32. procedure Register;
  33.  
  34. implementation
  35.  
  36. procedure Register;
  37. begin
  38.   RegisterComponents('InternetExpress', [TReadFileClientDataSet]);
  39. end;
  40.  
  41. { TReadFileClientDataSet }
  42.  
  43. procedure TReadFileClientDataSet.CloseCursor;
  44. var
  45.   SaveFileName: string;
  46. begin
  47.   // Prevent client data set file from being saved to disk.
  48.   SaveFileName := FileName;
  49.   FileName := '';
  50.   try
  51.     inherited CloseCursor;
  52.   finally
  53.     FileName := SaveFileName;
  54.   end;
  55. end;
  56.  
  57. end.
  58.