• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 167
  • Last Modified:

Creating a database at runtime

I need code/class/ActiveX that I can use to create a database (files, table, fields, ...) at runtime. I need to create Microsoft JET databases using DAO/ADO at runtime. Is there any web site that has some free sapmles I can use?
0
bmatumbura
Asked:
bmatumbura
  • 3
1 Solution
 
bnemmersCommented:
Hi,

You don't list the database you would like to create, Access, MS SQL, Oracle etc..
Take a look at TADOCommand Object it allows DDL SQL commands.

Good luck
Bill.
0
 
bmatumburaAuthor Commented:
Hie Bill,

Can I use TADOCommand to create MS Access databases or I can only use it to connect to an existing database file (either directly or using a DSN)?

I need to the application to create the .mdb file, the tables, fields etc. like what VB's DAO engine does.
0
 
bnemmersCommented:
Hi,

Sorry about the delay, I was out of town.
try this to create the Access db

procedure TForm1.Button1Click(Sender: TObject);
var
  ADOTest: Variant;
  ConnectStr: Variant;
begin
  ConnectStr := 'Provider=Microsoft.JET.OLEDB.4.0;Data source = c:\Test.mdb';
  ADOTest := CreateOleObject('ADOX.Catalog.2.5');
  ADOTest.Create(ConnectStr);
  ADOTest := '';
end;

Good luck
Bill
0
 
bnemmersCommented:
Hi,

One more thing. you might want to download "OLE/COM Object Viewer" from Micro$oft.
It's a nice tool for looking at all com's loaded on your computer. Open "MSADOX.dll" this will
give you all Interfaces in ADOX

http://www.microsoft.com/com/resources/oleview.asp

Bill
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now