Yazı Font Küçült Yazı Font Büyült

Delphide Access Veritabanına Bağlanmak 

 

Merhaba arkadaşlar bu makalemizde access veritabanına bağlanacağız.

Formumuza 2 adet DBEdit, 1 adet Button ekleyelim. Ayrıca formumuza 1 er adet DataSource, ADOConnection ve ADOTable ekleyelim.

 

 

Resim1

Şekil 1

 

unit ado_Unit1;

interface

uses

Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,

Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.Mask, Vcl.ExtCtrls,

Vcl.DBCtrls, Data.DB, Data.Win.ADODB;

type

TForm1 = class(TForm)

ADOConnection1: TADOConnection;

ADOTable1: TADOTable;

DataSource1: TDataSource;

DBEdit1: TDBEdit;

Button1: TButton;

DBEdit2: TDBEdit;

procedure Button1Click(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

var

Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);

begin

ADOConnection1.ConnectionString:=('Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\Db1.mdb; User Id=Admin;Password=; Persist Security Info=False'  );

ADOConnection1.Connected:=True;

ADOTable1.Connection:=ADOConnection1;

ADOTable1.TableName:='Musteri';

ADOTable1.Active:=True;

DataSource1.DataSet:=ADOTable1;

DBEdit1.DataSource:=DataSource1;

DBEdit1.DataField:='Adi';

DBEdit2.DataSource:=DataSource1;

DBEdit2.DataField:='Soyadi';

if DBEdit1.Text= '' then

begin

ADOConnection1.Connected:=True;

end;

end;

end.

 

 

Bir makalenin daha sonuna geldik. Bir sonraki makalede görüşmek üzere. Bahadır ŞAHİN