problem connecting to ADO programmatically
- From: "William Meyer" <meyer.wil@xxxxxxxxx>
- Date: 26 Apr 2008 10:15:24 -0700
I have taken the connection string created using the MS wizard, and
broken it into a series of constants, so I can replace the file path
dynamically. When I attempt to do this, I get the "Could not find
installable ISAM" error message. My code:
const
ADOProvider = 'Provider=Microsoft.Jet.OLEDB.4.0;';
ADOPassword = 'Password="";';
ADOUserID = 'User ID=Admin;';
ADODataSource = 'Data Source=I:\Development\CAP\CapWatch\CAPWATCH 24
MAY 07.MDB;';
ADOMode = 'Mode=Share Deny None;';
ADOExtProp = 'Extended Properties="";';
ADOJetTail = 'Jet OLEDB:System database="";OLEDB:Registry Path="";' +
'Jet OLEDB:Database Password="";Jet OLEDB:Engine Type=4;' +
'Jet OLEDB:Database Locking Mode=0;Jet OLEDB:Global
Partial Bulk Ops=2;' +
'Jet OLEDB:Global Bulk Transactions=1;Jet OLEDB:New
Database Password="";' +
'Jet OLEDB:Create System Database=False;Jet OLEDB:Encrypt
Database=False;' +
'Jet OLEDB:Don''t Copy Locale on Compact=False;' +
'Jet OLEDB:Compact Without Replica Repair=False;Jet
OLEDB:SFP=False';
function TDMCapWatch.ConnectToDB(DBFile: string): Boolean;
var
ConnStr: string;
target : string;
begin
Result := false;
if not FileExists(DBFile) then Exit;
ADOConnCAPWatch.Close;
ConnStr := ADOProvider + ADOPassword + ADOUserID;
target := 'DataSource=' + DBFile + ';';
ConnStr := ConnStr + target + ADOMode + ADOExtProp + ADOJetTail;
ADOConnCAPWatch.ConnectionString := WideString(ConnStr);
ADOConnCAPWatch.Open;
Result := ADOConnCAPWatch.Connected;
end;
If I comment out the assignment to ADOConnCAPWatch.ConnectionString,
there is no error. I have tried commenting out parts of the tail
strings, finally reaching this:
ConnStr := ADOProvider + ADOPassword + ADOUserID;
target := 'DataSource=' + DBFile + ';';
ConnStr := ConnStr + target; // + ADOMode + ADOExtProp + ADOJetTail;
ADOConnCAPWatch.ConnectionString := WideString(ConnStr);
ADOConnCAPWatch.Open;
Result := ADOConnCAPWatch.Connected;
I still get the error. Any suggestions?
--
Bill
.
- Follow-Ups:
- Re: problem connecting to ADO programmatically
- From: Pieter Zijlstra
- Re: problem connecting to ADO programmatically
- From: Chris.Cheney
- Re: problem connecting to ADO programmatically
- Prev by Date: Re: Use GUID instead of AutoInc
- Next by Date: Re: problem connecting to ADO programmatically
- Previous by thread: Strange AV deleting last record in access table
- Next by thread: Re: problem connecting to ADO programmatically
- Index(es):
Relevant Pages
|