StreamDsForm.pas
上传用户:fh681027
上传日期:2022-07-23
资源大小:1959k
文件大小:2k
源码类别:

Delphi控件源码

开发平台:

Delphi

  1. unit StreamDsForm;
  2. interface
  3. uses
  4.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  5.   StdCtrls, Db, Grids, DBGrids, ExtCtrls, DBCtrls, MdDsStream, MdDsCustom;
  6. type
  7.   TForm1 = class(TForm)
  8.     DataSource1: TDataSource;
  9.     DBGrid1: TDBGrid;
  10.     Panel1: TPanel;
  11.     Button1: TButton;
  12.     CheckBox1: TCheckBox;
  13.     DBNavigator1: TDBNavigator;
  14.     Button2: TButton;
  15.     MdDataSetStream1Name: TStringField;
  16.     MdDataSetStream1Level: TIntegerField;
  17.     MdDataSetStream1BirthDate: TDateField;
  18.     MdDataSetStream1Stipend: TCurrencyField;
  19.     MdDataSetStream1Email: TStringField;
  20.     MdDataSetStream1Editor: TBooleanField;
  21.     MdDataSetStream1: TMdDataSetStream;
  22.     procedure Button1Click(Sender: TObject);
  23.     procedure CheckBox1Click(Sender: TObject);
  24.     procedure FormCreate(Sender: TObject);
  25.     procedure Button2Click(Sender: TObject);
  26.   private
  27.     { Private declarations }
  28.   public
  29.     { Public declarations }
  30.   end;
  31. var
  32.   Form1: TForm1;
  33. implementation
  34. {$R *.DFM}
  35. procedure TForm1.Button1Click(Sender: TObject);
  36. begin
  37.   MdDataSetStream1.CreateTable;
  38.   MdDataSetStream1.Open;
  39.   CheckBox1.Checked := MdDataSetStream1.Active;
  40. end;
  41. procedure TForm1.CheckBox1Click(Sender: TObject);
  42. begin
  43.   MdDataSetStream1.Active := CheckBox1.Checked;
  44. end;
  45. procedure TForm1.FormCreate(Sender: TObject);
  46. begin
  47.   MdDataSetStream1.TableName :=
  48.     ExtractFilePath (ParamStr (0)) + 'Contrib.dso';
  49. end;
  50. procedure TForm1.Button2Click(Sender: TObject);
  51. var
  52.   bm: TBookmarkStr;
  53. begin
  54.   bm := MdDataSetStream1.Bookmark;
  55.   MdDataSetStream1.First;
  56.   while not MdDataSetStream1.EOF do
  57.     MdDataSetStream1.Next;
  58.   MdDataSetStream1.Bookmark := bm;
  59. end;
  60. end.