Page 1 of 1

AccessDB

Posted: Wed 19 Oct 2011 15:28
by radosamo
How can I create new AccessDB and table with UniDac components.
I have D2010.

Thank you.

Posted: Thu 20 Oct 2011 06:56
by AlexP
Hello,

At the moment UniDAC does not allow creating MS Access databases. We will consider adding this possibility in one of the future versions. Now you can create a database on your own using the following code:

Code: Select all

uses comobj,sysutils; 

............

function CreateAccessDatabase(FileName : String) : String; 
var cat : OLEVariant; 
begin 
result := ''; 
try 
  cat := CreateOleObject('ADOX.Catalog'); 
  cat.create ('Provider=Microsoft.Jet.OLEDB.4.0;Data Source='+Filename+';'); 
  cat := NULL; 
except 
  on e : Exception do result := e.message; 
end; 
end;