📄 demo8.pas
字号:
unit demo8;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, ADODB, Grids, DBGrids, StdCtrls;
type
TForm1 = class(TForm)
Edit1: TEdit;
Button1: TButton;
ListBox1: TListBox;
DataSource1: TDataSource;
DBGrid1: TDBGrid;
ADOConnection1: TADOConnection;
ADOTable1: TADOTable;
open_database: TOpenDialog;
Label1: TLabel;
Label2: TLabel;
procedure Button1Click(Sender: TObject);
procedure ListBox1DblClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
access:string;
const
link_str='Provider=%s; Data Source=%s';
dataprovider='microsoft.jet.oledb.4.0';
begin
open_database.FileName :='*.mdb';
if open_database.Execute then
begin
access:=open_database.FileName ;
edit1.Text :=access;
adoconnection1.Connected :=false;
adoconnection1.ConnectionString :=format(link_str,[dataprovider,access]);
adoconnection1.Connected :=true;
adoconnection1.GetTableNames(listbox1.Items);
end;
end;
procedure TForm1.ListBox1DblClick(Sender: TObject);
begin
adotable1.Close ;
adotable1.TableName :=listbox1.Items.Strings[listbox1.itemindex];
adotable1.Open ;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -