Solved

Creating a database at runtime

Posted on 2001-06-25
4
155 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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

707 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

20 Experts available now in Live!

Get 1:1 Help Now