I am now in a problem to prompt user at the first run of my program.
The Server is msSql Server 2008 R2 and Plaform vb.Net 2010. At the time of starting, the program starts to search the file, where the ConnectionString is saved. If it get then well else prompt to the user to get help to make the connection string.
User will choose the followings
1) Server / Host Name.
2) Windows Authentication or SQL Server Authentication
3) Database Name.
4) User Name & Password (For Server)
I am not understand where from I call it and how ?

Try this:

if Not YourConnection.state = ConnectionState.Open Then
'promot user
end if

If there is no connection string in the file where you expect it to be, just open a dialog box with fields for everything you want, and when the user clicks OK (and you have done a bit of validation), write it to the same file so that next time it will not prompt the user. Something like this (pseudocode):

dim exists as boolean = ... 'Does connection string exist in the file?
if (!exists) {
    'Open dialog
    ...
    'When dialog is closed, validate and write connection string to file
}

@SalmiSoft. I saw your Link in CodeProject. But it is quite different. User choose only a SQL Server not ODBC Driver, because the database is made by msSQL Server.

To every one.
To make a connection string is not a deficult job, by concatinating all supplied values by User. But the problem is where from I call or show the Dialog, which is more suitable to me and how.
I am also be in thinkikg, if I get an idea from my mind I also try to share with you all.
Thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.