Solved

ADO Connection String

Posted on 2001-09-05
4
218 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
  • 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

Industry Leaders: 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

Title # Comments Views Activity
can't find the executable in Simulator 1 112
SUM 2 INTEGER ARRAYS INTO 1 10 111
JAudiorecorder record freezing the app 29 82
Need Help Delphi 2010 CheckBox1 Stored value in memo 13 75
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
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…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

685 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