?
Solved

Integration with Access - Create DB

Posted on 2003-02-24
2
Medium Priority
?
138 Views
Last Modified: 2010-04-04
I merely want to create an Access Database (NOT Access Project) from Delphi using one of the Server components.
From there on I would probably like to create tables etc...

After trying Borland's help on the Server component's tab without success I tried Access's help - equally disappointing. I'd like a website or document that clarifies the Office type libraries up to the point where I don't have to hack away hours trying to come up with a really simple solution.

Any real help would be appreciated.
Regards
André
0
Comment
Question by:AndreDicks
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 17

Accepted Solution

by:
geobul earned 400 total points
ID: 8016015
Hi,

Here is a simple solution without using any server component.

uses ComObj;

// Version 3=95, 4=97, 5=2000
procedure CreateAccessDatabase(MDBName: string; Version: integer);
var
  Catalog: Variant;
begin
  Catalog := CreateOleObject('ADOX.Catalog');
  Catalog.Create('Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:Engine Type='+IntToStr(Version)+';Data Source='+MDBName+';');
end;

// usage:
procedure TForm1.Button1Click(Sender: TObject);
begin
  CreateAccessDatabase('D:\new.mdb',4);
end;

// create a table in it (needs ADOQuery1 component on the form)
procedure TForm1.Button2Click(Sender: TObject);
begin
with ADOQuery1 do begin
  Close;
  ConnectionString := 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source=d:\new.mdb;';
  SQL.Clear;
  SQL.Add('CREATE TABLE Table1 (Field1 char(20), Field2 integer)');
  ExecSQL;
end;
end;

Regards, Geo
0
 

Expert Comment

by:CleanupPing
ID: 9317082
AndreDicks:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses
Course of the Month8 days, 6 hours left to enroll

765 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