Re: problem connecting to ADO programmatically



Chris.Cheney wrote:

Hi Bill,

Perhaps your ADOConnCAPWatch component has acquired some custom
settings? With the default component and no connection string, an
error SHOULD occur when it is opened - but you say that there is no
error in this case. Try creating the component dynamically (to be
sure it has no custom settings).

Sorry, I did not provide adequate info. There is a ConnectString in
place statically, which I set up with the wizard. It works fine. The
problem comes when I try to merely change the Data Source element of
that string.

FWIW The following works for me (AdoConnection1 is a default instance
of the TAdoConnection component - i.e. no custom settings):

const
Provider = 'Provider=Microsoft.Jet.OLEDB.4.0;';
DataSource = 'Data Source=C:\Documents and Settings\chris\My
Documents \Database Stuff\ExcelAdo Samples\data.mdb;';
User = 'User ID=admin;';
Password = 'Password="";';
begin
AdoConnection1.ConnectionString := Provider + DataSource + User +
Password;
AdoConnection1.Open;
end;

I will give it a try with those minimal elements. What I find
interesting now is that I took the string constants from the existing
ConnectString I set with the wizard. If I simply copy that to a local
var and copy the local var back to the ConnectString, all is well. If I
try to make any alteration to the content of the string before
assigning it to ConnectString, I get the error. And of course, that
error message is both misleading and unuseful, as it is a) not a
problem with ISAM, and b) it gives no clue what it's unhappy about .

--

Bill
.



Relevant Pages

  • Re: problem connecting to ADO programmatically
    ... Perhaps your ADOConnCAPWatch component has acquired some custom ... sure it has no custom settings). ... interesting now is that I took the string constants from the existing ... var and copy the local var back to the ConnectString, ...
    (borland.public.delphi.database.ado)
  • Re: Create DSN-Less link to Foxpro table
    ... I'm afraid I have absolutely no experience using FoxPro, ... Dim wk As DAO.Workspace ... Dim ConnectString As String ...
    (microsoft.public.access.externaldata)
  • Re: Create DSN-Less link to Foxpro table
    ... Dim wk As DAO.Workspace ... Dim ConnectString As String ... 'Following code is required because no primary key is defined on personne. ...
    (microsoft.public.access.externaldata)
  • Re: Create DSN-Less link to Foxpro table in Access
    ... Dim wk As DAO.Workspace ... Dim ConnectString As String ... 'Following code is required because no primary key is defined on personne. ...
    (microsoft.public.fox.vfp.dbc)
  • Re: Create DSN-Less link to Foxpro table in Access
    ... Look under the DataFiles section and ther they have Visual FoxPro for both ... Dim db As DAO.Database ... Dim ConnectString As String ...
    (microsoft.public.fox.vfp.dbc)