unit DBUsers;

interface

uses ADODB, Math, SysUtils, Classes, Windows, DB;

type
  TDBUsers = class
  private
    var
      conDB: TADOConnection;
      tblMusic: TADOtable;
      qry: TADOQuery;
      dsrTbl: TDataSource;
      dsrSQL: TDataSource;
      SQL: String;
  end;
  public
    Procedure connectDB;

Var
  DBUsers : TDBUsers;

implementation

Procedure TDBUsers.connectDB;
begin
  conDB := TADOConnection.Create(Self);
  // replace DB name
  conDB.ConnectionString :=
    'Provider=Microsoft.Jet.OLEDB.4.0;Data Source=SelaMusicSchool.mdb;' +
    'Mode=ReadWrite;Persist Security Info=False';

  conDB.LoginPrompt := false;
  conDB.Connected := true;

  tblMusic := TADOtable.Create(Self);
  tblMusic.Connection := conDB;
  // replace TABLE Name
  tblMusic.TableName := 'MusicSchoolData';
  tblMusic.Active := true;

  qry := TADOQuery.Create(Self);
  qry.Connection := conDB;

  dsrTbl := TDataSource.Create(Self);
  dsrTbl.DataSet := tblMusic;

  dbgTable.DataSource := dsrTbl;

  dsrSQL := TDataSource.Create(Self);
  dsrSQL.DataSet := qry;

end;
end.
