tags:

views:

353

answers:

2

I have been developing an application for the last 12 months using VS2008, VB.NET(WPF) and SQLExpress2008. It has been running successfully in a single organization but I now need to consider deploying it to other organisations where I won't know the connection string for the DB, app locations, server locations etc.

What is the current favoured approach for deploying dotNet apps that use SQL Express 2008? ClickOnce? InstallShield?

Also, what's the best way of requesting the initial connection string details. Should I write it myself and maybe store the info in my.settings, are there any 3rd party apps for db configuration that'll make my life easier?

Sorry for all the questions but the bottom line is, what's the best way to deploy my app!

+2  A: 

I take it from your mention of ClickOnce that this is not an ASP.NET application. Please correct me if I'm wrong, and edit your question as well.

I have been successful with simple applications in creating a normal Setup for it. I've prompted for server name and database name as separate parameters. In fact, in one setup, I was able to prompt for server name with one prompt form, Windows vs. SQL Server authentication with a radio button on a second, then user and password on the third if the "SQL Server" button had been clicked. I passed the resultant values as parameters to a little Installer class that created the connection string from the individual pieces.

In this particular case, I used the connection string right away in order to execute some SQL scripts, but you could just as easily store the connection string in the app.config for the program to use later.

Another option, at least for a program with a GUI, is to have a settings dialog that can set the connection string, and to prompt the user to set it whenever it's not set. It would not be set the first time the program is run, so you could wait until the first time, or else launch the program once it's installed, prompt for the required settings, then maybe just set them and exit. That has the advantage of a better UI, and reuse of code.

John Saunders
Hi John, I'm targeting WPF, not ASP.Net. Ammended my question too to make it clearer. Thanks for your reply, your answer is pretty much the direction I'm thinking of taking. I just didn't want to be heading in the wrong direction or reinventing the wheel! I'd recently seen an app written in VB.Net that had a really great utility for creating the DB connections and wondered if it was written for the app or was some sort of add-in. Thanks again for your feedback...
Mitch
@Mitch: want a really cheap connection string UI? Connect a SqlConnectionString object to a Windows Forms PropertyGrid.
John Saunders
A: 

Generally those UI's are recreated every time by every developer and only about 20% of the reason being product look & feel, you can use the SqlConnectionString class as a back end object, and make sure your validation checks for a connection.

Tom Anderson