unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Grids, DBGrids, StdCtrls,
DB, ADODB, Menus;
type
TForm1 =
class(TForm)
Button1: TButton;
DataSource1: TDataSource;
ADOTable1: TADOTable;
DBGrid1: TDBGrid;
MainMenu1: TMainMenu;
Datei1: TMenuItem;
ffnen1: TMenuItem;
N1: TMenuItem;
Speichern1: TMenuItem;
Speichernunter1: TMenuItem;
N2: TMenuItem;
Beenden1: TMenuItem;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Beenden1Click(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
close;
end;
// Hinzufügen der Laufzeitanbindung
procedure TForm1.FormCreate(Sender: TObject);
var verz:
string;
begin
// Ermitteln des aktuellen Pfades
verz := ExtractFilePath(ParamStr(0));
with ADOTable1
do
begin
try
ConnectionString := '
Provider=Microsoft.Jet.OLEDB.4.0;Data Source='+verz+'
db1.mdb;Mode=Read|Write|Share Deny None;Persist Security Info=False';
TableName := '
db1';
Active := true
except
Beep;
ShowMessage('
Die Datenbank DB1.MDB befindet sich nicht '+ #10#13 + '
im aktuellen Verzeichnis '+verz)
end
end
end;
procedure TForm1.Beenden1Click(Sender: TObject);
begin
close;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
// hier soll die aktuelle Tabelle in Access gespeichert werden
end;
end.