How can I import a Access Database in my program on a non Delphi computer without installing BDE Administrator.
BDE Administrator Size is too big and maybe can be installed only some files of it.
You can use the ADO components to import Access databases - no need to use the BDE at all. This is the preferred method of using Access (Jet) databases.
I allready used BDE in my program and I don't have time to change it with ADO.
For Griffin: You helped me with EnsureDataPath procedure (to create an ODBC and an BDE Alias) and it works very well, but I need to import Excel Tables too. I modified this procedure and it creates an ODBC and a BDE alias for Excel, but it doesn't write in ODBC the table name.
Here it is:
procedure TForm1.EnsureDataPath(AODBC, ADescription, ADatabase, AAlias: String);
const
ODBCKey = '\SOFTWARE\ODBC\ODBC.INI';
var
s : String;
l : TStringList;
//Registry:TRegistry;
begin
with TRegistry.Create do
try
RootKey := HKEY_LOCAL_MACHINE;
if not OpenKey(ODBCKey + '\' + AODBC, False) then // ODBC entry has not been set up
begin
OpenKey(ODBCKey + '\' + AODBC + '\Engines\Jet', True);
WriteString('ImplicitCommitSync', '');
WriteInteger('MaxBufferSize', 2048);
WriteInteger('PageTimeout', 5);
WriteInteger('Threads', 3);
WriteString('UserCommitSync', 'Yes');
CloseKey;
OpenKey(ODBCKey + '\ODBC Data Sources', True);
WriteString(AODBC,'Microsoft Excel Driver (*.xls)');
CloseKey;
OpenKey(ODBCKey + '\' + AODBC, True); // create key
s := '\System';
if UpperCase(GetEnvironmentVariable('OS')) = 'WINDOWS_NT' then
s := s + '32';
WriteString('Driver', GetEnvironmentVariable('WINDIR') + s + '\odbcjt32.dll');
WriteInteger('DriverId', 25);
WriteString('FIL','MS Excel;');
WriteInteger('SafeTransactions', 0);
WriteString('UID', '');
WriteString('Description', ADescription);
end;
WriteString('DBQ', ADatabase);
CloseKey;
finally
Free;
end;
if not Session.IsAlias(AAlias) then { BDE Alias doesn't exist }
begin
l := TStringList.Create;
try
l.Append('DATABASE NAME=');
l.Append('USER NAME=');
l.Append('ODBC DSN=' + AODBC);
l.Append('OPEN MODE=READ/WRITE');
l.Append('SCHEMA CACHE SIZE=8');
l.Append('SQLQRYMODE=');
l.Append('LANGDRIVER=');
l.Append('SQLPASSTHRU MODE=SHARED AUTOCOMMIT');
l.Append('SCHEMA CACHE TIME=-1');
l.Append('MAX ROWS=-1');
l.Append('BATCH COUNT=200');
l.Append('ENABLE SCHEMA CACHE=FALSE');
l.Append('SCHEMA CACHE DIR=');
l.Append('ENABLE BCD=FALSE');
l.Append('ROWSET SIZE=20');
l.Append('BLOBS TO CACHE=64');
Session.AddAlias(AAlias, 'Microsoft Excel Driver (*.xls)', l);
finally
l.Free;
end;
end;
end;
I wrote all the entries for EnsureDataPath by setting up a connection the 'normal' way using BDE Administrator and the system ODBC manager, and then copying all the registry entries and BDE settings into code. My suggestion is you try doing the same for your Excel connection and seeing where it differs from the Access setup. It's quite plausible that there are key differences that just aren't allowed for in the Access setup.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.