Re: Cannot Connect ADOConnection at Run-Time



Hey Mike....

Your code is not building the same connection string as your connection
string... if you know what I mean.

You're gonna have to construct it exactly if you're gonna go that way....
semi-colons and all. You are changing words, ie, the provider is completely
different, what is 'data source', and where is DSN...

I think you'll find too that wherever you see a 'quote' in the string that
you'll have to provide that if you are building the sting on the fly... (why
are you doing all of this??? I just drop it, fill it in and go... connect
in the application and don't fiddle with the connection string... how is
yours different?)

So, like this: connstring + '''some stupid line of text that needs to be
quoted in the string''';

hope that helps
b
"Mike Sandoval" <NoThankYou@xxxxxxxxxxxxxx> wrote in message
news:426e3bcc@xxxxxxxxxxxxxxxxxxxxxxxxx
> Andy wrote:
> > What is your ConnectionString ?
> >
> > Andy
> > "Mike Sandoval" <NoThankYou@xxxxxxxxxxxxxx> wrote in message
> > news:426dab20$1@xxxxxxxxxxxxxxxxxxxxxxxxx
> >
> >>Thank you Betsy,
> >>
> >>It still does not work. It only works if it is set Connected := true at
> >>design time; otherwise, I cannot connect at Run-time.
> >>
> >>Any other ideas?
> >>
> >>Mike
> >
> >
> >
> Andy,
>
> Here is my ConnectionString:
>
> Provider=MSDASQL.1;Persist Security Info=False;User
> ID=administrator;Extended Properties="DSN=MS Access
> Database;DBQ=C:\Data\ABC Database\db1.mdb;DefaultDir=C:\Data\ABC
> Database;DriverId=25;FIL=MS
> Access;MaxBufferSize=2048;PageTimeout=5;UID=admin;"
>
>
>
> I have also tried...
>
> strfile := 'C:\Data\ABC Database\db1.mdb';
> with ADOConnection1 do begin
> Close;
> ConnectionObject := nil;
> end;
> ADOConnectionString := '';
> ADOConnectionString := 'Provider=Microsoft.Jet.OLEDB.4.0;';
> ADOConnectionString := ADOConnectionString + 'Data Source=' + strfile
> + ';';
> ADOConnectionString := ADOConnectionString + 'Persist Security
> Info=True' +';';
> ADOConnection1.ConnectionString := ADOConnectionString;
>
> Thanks...


.



Relevant Pages

  • Re: ADO connections question
    ... Function CreateADOObjects(ConnectionString as string) ... you'll see this error if the connection has not been ... I have a specific login form that calls the dbLogin function as shown ... Dim strCriteria As String ...
    (microsoft.public.access.adp.sqlserver)
  • Re: Nochmals Treeview
    ... private void button1_Click(object sender, System.EventArgs e) { ... private void TabelleAnlegen(string strDBPfad, string strDB, string strTabellenName){ ... OleDbConnection connection = new OleDbConnection; ... OleDbCommand command = new OleDbCommand; ...
    (microsoft.public.de.german.entwickler.dotnet.csharp)
  • Re: ExecuteReader requires an open and available Connection.
    ... you have ALL your users sharing one connection. ... Public Shared Function GetServerAs String ... Dim theServer As String ...
    (microsoft.public.dotnet.framework.aspnet)
  • RE: Error using Login control ASP.NET App_Data Folder
    ... the UserInstance type of connection string is for SQLEXPRESS only and is ... Server Management Studio and use a standard connection ... An error has occurred while establishing a connection to the server. ... SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, ...
    (microsoft.public.dotnet.framework.aspnet)
  • Change Connection String during runtime
    ... connection is stored in the app.config file. ... connection string without exiting the application. ... Dim newConnection As String ... Private Sub RecordDatabase_Enter(ByVal sender As Object, ...
    (microsoft.public.dotnet.languages.vb)