Re: Creating a MS Access database

From: Brian Bushay TeamB (BBushay_at_Nmpls.com)
Date: 05/26/04


Date: Tue, 25 May 2004 20:37:10 -0500


>I would like to create a new MDB file with some tables. I have never done
>this before, so I wonder what steps should I follow.

If you import the ADOX type library you can use code like this to create an
access database.

var
   Catalog: _Catalog;
   CS,dbName: string;
begin
   dbName := 'myNewAccessDB6.mdb';
   Catalog := CreateCOMObject(StringToGUID('ADOX.Catalog')) as _Catalog;
   CS := 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source=' + dbName
    // Engine type = 5 creates 2000 database
 +';Jet OLEDB:Engine Type=5';
   if FileExists(dbName) then
      DeleteFile(dbName);
   Catalog.Create(CS);
   Catalog := nil;

end;

--
Brian Bushay (TeamB)
Bbushay@NMPLS.com


Relevant Pages

  • Re: Microsoft Access and the Jet Engine
    ... > If I want to connect to an Access database from Delphi, do I need to have Access installed? ... Brian Bushay (TeamB) ...
    (borland.public.delphi.database.ado)
  • Re: Strange problem
    ... Its easy to corrupt an Access database. ... You should try compacting it and see if ... Brian Bushay (TeamB) ...
    (borland.public.delphi.database.ado)
  • Re: locking in ADO
    ... >typically updating records for about 40-60 people connected at a time, ... That is too may users for an Access database. ... Brian Bushay (TeamB) ...
    (borland.public.delphi.database.ado)
  • Re: TAdoQuery.Locate and TDateTime fields
    ... >used on a TDateTime field. ... you are probably looking miliseconds in the conversion to string for the ... Brian Bushay (TeamB) ...
    (borland.public.delphi.database.ado)
  • Re: Problem with OpenSchema not returning all views
    ... >which needs to list all the tables and views in an Access database. ... Access categorizes some queries as Stored procedures. ... Brian Bushay (TeamB) ...
    (borland.public.delphi.database.ado)