|
|
@@ -0,0 +1,48 @@
|
|
|
+unit AccessDBCase;
|
|
|
+
|
|
|
+interface
|
|
|
+
|
|
|
+uses
|
|
|
+ Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|
|
+ Dialogs, ADODB, Grids, DBGrids, DB;
|
|
|
+
|
|
|
+type
|
|
|
+ TForm7 = class(TForm)
|
|
|
+ con1: TADOConnection;
|
|
|
+ ds1: TADODataSet;
|
|
|
+ ds2: TDataSource;
|
|
|
+ dbgrd1: TDBGrid;
|
|
|
+ procedure FormCreate(Sender: TObject);
|
|
|
+ procedure FormDestroy(Sender: TObject);
|
|
|
+ private
|
|
|
+ { Private declarations }
|
|
|
+ public
|
|
|
+ { Public declarations }
|
|
|
+ end;
|
|
|
+
|
|
|
+var
|
|
|
+ Form7: TForm7;
|
|
|
+
|
|
|
+implementation
|
|
|
+
|
|
|
+{$R *.dfm}
|
|
|
+
|
|
|
+procedure TForm7.FormCreate(Sender: TObject);
|
|
|
+begin
|
|
|
+ con1.ConnectionString := 'Provider=Microsoft.Jet.OLEDB.4.0; Data Source=MessageHistory.DAT;';
|
|
|
+ ShowMessage('1');
|
|
|
+ con1.Connected := True;
|
|
|
+ ShowMessage('2');
|
|
|
+ ds1.CommandText := 'SELECT TOP 8 * FROM MESSAGES';
|
|
|
+ ShowMessage('3');
|
|
|
+ ds1.Open;
|
|
|
+ ShowMessage('4');
|
|
|
+end;
|
|
|
+
|
|
|
+procedure TForm7.FormDestroy(Sender: TObject);
|
|
|
+begin
|
|
|
+ ds1.Close;
|
|
|
+ con1.Connected := False;
|
|
|
+end;
|
|
|
+
|
|
|
+end.
|