Board index » delphi » Create Access MDB file at runtime..how?

Create Access MDB file at runtime..how?

How can I create an ms Access database file at runtime?

I can create tables with SQL once I have the .mdb file created but I
need to know how I can create the .MDB file in Delphi 5?

Bill

----------------------
Bill Artemik
Programmer / Analyst
b...@droste1.com

"He who procrastinates

 

Re:Create Access MDB file at runtime..how?


Have look on codesite - there is a c++ builder example on calling the
ODBC Installer API to create, repair and compact MDBs.
These are exactly the same (AFAIK) as the buttons you seen when
selecting a database for an Access DSN.
It's pretty easy to translate to Delphi, as the functions are performed
by just building a command string.

HTH

Quote
Bill Artemik wrote:

> How can I create an ms Access database file at runtime?

> I can create tables with SQL once I have the .mdb file created but I
> need to know how I can create the .MDB file in Delphi 5?

> Bill

> ----------------------
> Bill Artemik
> Programmer / Analyst
> b...@droste1.com

> "He who procrastinates

Re:Create Access MDB file at runtime..how?


Where is codesite?

On Tue, 16 Oct 2001 14:35:10 +0100, patrick martin

Quote
<patrickmmar...@freenet.co.uk> wrote:
>Have look on codesite - there is a c++ builder example on calling the
>ODBC Installer API to create, repair and compact MDBs.
>These are exactly the same (AFAIK) as the buttons you seen when
>selecting a database for an Access DSN.
>It's pretty easy to translate to Delphi, as the functions are performed
>by just building a command string.

>HTH

>Bill Artemik wrote:

>> How can I create an ms Access database file at runtime?

>> I can create tables with SQL once I have the .mdb file created but I
>> need to know how I can create the .MDB file in Delphi 5?

>> Bill

>> ----------------------
>> Bill Artemik
>> Programmer / Analyst
>> b...@droste1.com

>> "He who procrastinates

----------------------
Bill Artemik
Programmer / Analyst
b...@droste1.com

"He who procrastinates

Re:Create Access MDB file at runtime..how?


access := CreateOleObject('DAO.DBEngine.35');
access.CreateDatabase(FileName, ';LANGID=0x0409;CP=' + IntToStr(GetACP()) +
';COUNTRY=0', 0);
access := UnAssigned;

where access: Variant.

If you want to create a dtabase with MS Access 2000 format, just use 36
instead 35 in CreateOLEObject command.

--
With best regards, Mike Shkolnik
E-Mail: mshkol...@scalabium.com
        mshkol...@yahoo.com
WEB: http://www.scalabium.com

Bill Artemik <B...@droste1.com> ??? a
????:3bcc2ab6.6999...@newsgroups.borland.com...

Quote
> How can I create an ms Access database file at runtime?

> I can create tables with SQL once I have the .mdb file created but I
> need to know how I can create the .MDB file in Delphi 5?

> Bill

> ----------------------
> Bill Artemik
> Programmer / Analyst
> b...@droste1.com

> "He who procrastinates

Re:Create Access MDB file at runtime..how?


Thanks, Mike. That did it!

On Wed, 17 Oct 2001 13:39:00 +0300, "Mike Shkolnik"

Quote
<mshkol...@yahoo.com> wrote:
>access := CreateOleObject('DAO.DBEngine.35');
>access.CreateDatabase(FileName, ';LANGID=0x0409;CP=' + IntToStr(GetACP()) +
>';COUNTRY=0', 0);
>access := UnAssigned;

>where access: Variant.

>If you want to create a dtabase with MS Access 2000 format, just use 36
>instead 35 in CreateOLEObject command.

----------------------
Bill Artemik
Programmer / Analyst
b...@droste1.com

"He who procrastinates

Other Threads