maxkleiner / maXbox4

code compiler script studio
GNU General Public License v3.0
23 stars 10 forks source link

Create Access Database #21

Closed maxkleiner closed 2 years ago

maxkleiner commented 3 years ago

TADOConnection encapsulates the ADO connection object. Use TADOConnection for connecting to ADO data stores. The connection provided by a single TADOConnection component can be shared by multiple ADO command and dataset components through their Connection properties.

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
    writeln(ExceptionToString(ExceptionType, ExceptionParam));
    writeln('ADOX.Catalog create failed ');
    //on e: Exception do Result := e.message;
  end;
end;
maxkleiner commented 2 years ago

Works fine with OLEVariant and helpers_: Function GetOleVariantEnum( Collection : OLEVariant) : IGetOleVariantEnum); Function GetOleVariantArrEnum( Collection : OLEVariant) : IGetOleVariantEnum);