Board index » delphi » Access Tables...

Access Tables...

Ok lets get this straight so, Access .mdb files can contain one or more
tables?

So i want to create this .mdb file along with a couple of tables in it.

How do i do it?

How i learn more about access databases and RDMS in general?

Manny
mani...@hotmail.com

 

Re:Access Tables...


An easy way to learn more about RDBMS is to review the on-line SQL help in
Delphi.  (I have the CS version, I'm not sure how the help differs)
Quote
Manindra wrote in message <01bdf0c9$14d15dc0$c949bacd@manny>...
>Ok lets get this straight so, Access .mdb files can contain one or more
>tables?

>So i want to create this .mdb file along with a couple of tables in it.

>How do i do it?

>How i learn more about access databases and RDMS in general?

>Manny
>mani...@hotmail.com

Re:Access Tables...


Quote
>Ok lets get this straight so, Access .mdb files can contain one or more
>tables?
Yes

>So i want to create this .mdb file along with a couple of tables in it.
>How do i do it?

You can create a .mdb file using Ole automation.   Tables can be created with
Delphi CreateTable method or with SQL

//Code to use Ole Automation to create .mdb with DAO 3.5
onst // DAO MSAccess Jet Engine constants
  DAOMSJet = 'DAO.DBEngine.35'; // 'DAO.DBEngine'
  dbLangGeneral = ';LANGID=0x0409;CP=1252;COUNTRY=0';

  dbVersion10 = 1;
  dbEncrypt   = 2;
  dbDecrypt   = 4; {only used when packing}
  dbVersion11 = 8;
  dbVersion20 = 16; (choose for Access 2.0)
  dbVersion30 = 32; {choose this for Access 95 database}
  {Recordset Type Enums}
  dbOpenTable = 1;       // single table, no links, updatable
  dbOpenDynaset = 2;     // updatable, only read when needed
  dbOpenSnapshot = 4;    // not updatable, in memory
  dbOpenForwardOnly = 8; // snapshot, forward scrolling only
  dbOpenDynamic = 16;    // ODBC only, updatable

var
  Form1: TForm1;

implementation

{$R *.DFM}

function tform1.DAOJetCreateDB(const DBName: string; Locale: String;
options: integer):boolean;

var
    Dao, Wks: variant;
begin
result := false;
try
  Dao := CreateOleObject(DAOMSJet);
  Wks := Dao.Workspaces[0];
  Work.CreateDatabase(DBName, Locale, Options);
  Wks := Unassigned;
  Dao := Unassigned;
  result := true;
finally end;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
     DAOJetCreateDB('d:\workdir\db1.mdb', dbLangGeneral, dbVersion20);
end;

--
Brian Bushay (TeamB)
Bbus...@DataGuidance.com

Re:Access Tables...


I used MS-Access 97 to create the database. You can then use its replication
to create more databases and update the table structures etc.

Craig.

Quote
Manindra wrote in message <01bdf0c9$14d15dc0$c949bacd@manny>...
>Ok lets get this straight so, Access .mdb files can contain one or more
>tables?

>So i want to create this .mdb file along with a couple of tables in it.

>How do i do it?

>How i learn more about access databases and RDMS in general?

>Manny
>mani...@hotmail.com

Other Threads