Page 1 of 1

Connectionstring

Posted: Thu Dec 14, 2006 5:27 am
by PetSo
Is there any way to let the user build a ADO connectionstring when installing?

Re: Connectionstring

Posted: Thu Dec 14, 2006 9:01 am
by Gizm0
PetSo wrote:Is there any way to let the user build a ADO connectionstring when installing?


Yes, quite easily.

Posted: Thu Dec 14, 2006 9:29 am
by PetSo
Would you mind telling me how?

I can't see any dialog to use to do it.


In Delphi I would do something like this.

Code: Select all

procedure TForm1.Button1Click(Sender: TObject);
var
  str: String;
begin
  str := PromptDataSource(0,'');
  Label1.Caption := str;
end;

Posted: Thu Dec 14, 2006 1:00 pm
by Gizm0
I don't know anything about Delphi, the fact is that you can build an ADO string during installation and save it on a text file, xml file, whatever you want and afterwards read it from your application. 8)

You need Studio version for that (so you can edit dialogs) and some basic scripting on MSICode.

Posted: Thu Dec 14, 2006 1:43 pm
by CandiceJones
Exactly, so the workflow would be like:

1) Build the user interface so you can query the end-user in an appropriate way,
2) Set your form controls to write to script variables,
3) Initialize those script variables before showing the form with their default values,
4) Use those variables to form the connection string any way you like, and perhaps store that in a new variable,
5) Do anything you like with the connection string!

Posted: Fri Dec 15, 2006 3:44 am
by PetSo
I'm sorry I wasn't more specific, since the dialog editor UI seems to be modelled after Delphi I assumed you where familiar with it.

In the oledb interface IDBPromptInitialize there is a function call PromptDataSource that brings up a wizard that lets the user build an ADO connectionstring.

What I wondered was if there was an easy way to access that functionality since it seems to me that it would be something many installations would like to do.

Posted: Mon Dec 18, 2006 9:58 am
by PetSo
I sort of solved it by making a plug in that design time prompts for the variable that should receive the connection-string and run-time shows the user the connection-string builder wizard.

But it would be nice if you could show the wizard as a response to a button press and present the resulting connection-string in a edit-control.

Posted: Tue Dec 19, 2006 11:00 am
by CandiceJones
You actually can - see the CD Autorun sample for handling individual button clicks.

Re: Help Plz

Posted: Wed Jan 22, 2014 6:30 am
by etedali
CandiceJones wrote:Exactly, so the workflow would be like:

1) Build the user interface so you can query the end-user in an appropriate way,
2) Set your form controls to write to script variables,
3) Initialize those script variables before showing the form with their default values,
4) Use those variables to form the connection string any way you like, and perhaps store that in a new variable,
5) Do anything you like with the connection string!


sorry i don't understand can you explain more
thanks a lot
best regards

Re: Connectionstring

Posted: Wed Jan 22, 2014 12:13 pm
by FrancescoT
Dear User,

Because the previous workflow you're referring to seems to be almost clear, probably if you try to describe which is exactly your target, it could help us to assist you.

Regards