Solved

ADO Connection String

Posted on 2001-09-05
4
204 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:mnasman
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
thats great.

Thanks
Woody.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

763 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now