Solved

Creating a database at runtime

Posted on 2001-06-25
4
156 Views
Last Modified: 2010-04-06
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
Comment
Question by:bmatumbura
  • 3
4 Comments
 
LVL 1

Accepted Solution

by:
bnemmers earned 50 total points
ID: 6225707
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
 
LVL 11

Author Comment

by:bmatumbura
ID: 6227355
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
 
LVL 1

Expert Comment

by:bnemmers
ID: 6232271
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
 
LVL 1

Expert Comment

by:bnemmers
ID: 6232348
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Delivering innovative fully-managed cloud services for mission-critical applications requires expertise in multiple areas plus vision and commitment. Meet a few of the people behind the quality services of Concerto.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

919 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now