Re: problem connecting to ADO programmatically



"William Meyer" <meyer.wil@xxxxxxxxx> wrote in news:4813632c$1
@newsgroups.borland.com:

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:

<snipped the complicated stuff>

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?

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).

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;

HTH

Regards

Chris
.



Relevant Pages

  • Re: Deployment + Vista
    ... The problem is it's connection string is always ... Server settings form. ... possibly occur with a file created by your app. ... I guess it's a good thing I do not use that for settings. ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Deployment + Vista
    ... The problem is it's connection string is always ... Server settings form. ... possibly occur with a file created by your app. ... I guess it's a good thing I do not use that for settings. ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: custom white balance/exposure questions ?
    ... Manuel exposure ... Then I did a custom wb and reshot with these settings: ... Do you mean a three channel histogram. ...
    (rec.photo.digital)
  • Re: Why force a connection string scope to be application?
    ... Great then please tell me me how when using My Project> Settings designer, ... I can create an application setting of type connection string that is not ... for me to learn here or is it just like that for no particular reason at ... There is not neccessarily a sound answer to this question, Microsoft are not ...
    (microsoft.public.dotnet.framework)
  • Re: Change Connection String at runtime.
    ... easily moved to another database, or have versions for each database. ... connection string to the connectionobject before the connection opens. ... *The Server IP number is different for every deployment. ... It appears that the generated code uses the application settings to ...
    (microsoft.public.dotnet.framework.adonet)