Solved

ADO Connection String

Posted on 2001-09-05
4
220 Views
Last Modified: 2013-11-23
Hi Guys,
   Any idea how I launch the connection string dialogue through code and recieve the connection string.

{
In the ADOConnection component clicking the ... button next to the connectionstring property causes a connection string dialogue with a BUILD button that lets you build your connection string
}

I need to be able to launch that dialogue though code.

Many Thanks
John.
0
Comment
Question by:WoodyJ007
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 22

Expert Comment

by:Mohammed Nasman
ID: 6456202
Hello

  I don't know if i understand you well, but if you want to set the connectionstrings from code, this code, will connect to access database the file on the c:\

procedure TForm1.Button1Click(Sender: TObject);
begin
  ADOTable1.ConnectionString. := 'Provider=Microsoft.Jet.OLEDB.4.0;Password="";Data Source=c:\db1.mdb;Persist Security Info=True';
  ADoTable1.TableName := 'Users';
  ADOTable1.Active := True;
end;
0
 

Author Comment

by:WoodyJ007
ID: 6456261
I want to show the dialog.  With the ConnectionString Dialogue you can choose many different types of connection.
0
 
LVL 17

Accepted Solution

by:
inthe earned 100 total points
ID: 6456266
hi,
to show the dialog at runtime you can do:

procedure TForm1.Button1Click(Sender: TObject);
var
s : string;
begin
  if adoconnection1.connected then
  begin
    adoconnection1.Connected:=false;
  end else
  begin
    s := adoconnection1.ConnectionString;
    s := adodb.PromptDataSource(self.Handle, s);
    adoconnection1.ConnectionString := s;
    try
      adoconnection1.connected:=true;
    except
    end;
  end;
  memo1.text := s;
end;
0
 

Author Comment

by:WoodyJ007
ID: 6456275
thats great.

Thanks
Woody.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question