Click here to Skip to main content
15,888,286 members
Home / Discussions / C#
   

C#

 
GeneralRe: SQL Connection problem Pin
Mycroft Holmes9-Jun-09 4:17
professionalMycroft Holmes9-Jun-09 4:17 
GeneralTelepathetic Software is already here Pin
Ennis Ray Lynch, Jr.9-Jun-09 5:38
Ennis Ray Lynch, Jr.9-Jun-09 5:38 
GeneralRe: SQL Connection problem Pin
SilimSayo9-Jun-09 6:30
SilimSayo9-Jun-09 6:30 
AnswerRe: SQL Connection problem Pin
saanj9-Jun-09 3:13
saanj9-Jun-09 3:13 
AnswerRe: SQL Connection problem Pin
Simon P Stevens9-Jun-09 5:01
Simon P Stevens9-Jun-09 5:01 
GeneralRe: SQL Connection problem Pin
deepseeindeepsy9-Jun-09 18:55
deepseeindeepsy9-Jun-09 18:55 
GeneralRe: SQL Connection problem Pin
Simon P Stevens11-Jun-09 3:08
Simon P Stevens11-Jun-09 3:08 
AnswerRe: SQL Connection problem Pin
Henry Minute9-Jun-09 8:09
Henry Minute9-Jun-09 8:09 
KIDYA wrote:
My problem is when i am switching to another SQL SERVER with my project then every time i have to change my connection string.


That will always be the case.
The only solution, that I can think of, there may be others but they escape me for now.

1. Try connecting using your stored connectionstring, catch exceptions and when the exception shows database absent
2a. Create a clone of the MS Server Connection Dialog and let the user 'find' the right server. OR
2b. Iterate over all available servers and do 1. above uon each one ntil you find the database, then modify the current connectionstring to match.

You might find it useful to read up on the ConnectionStringBuilder class for a fairly easy way to modify connection strings.
You might also want to download the SQLServer 2008/2005 Samples from Microsoft Download site for an example of cloning the dialog. If you do so an example will be found at YourDrive:\YourBaseDirectory\Samples\Engine\Programmability\SMO\ServerConnect\CS\ServerConnect.
In the Samples directory tree you will also find examples of how to find all available servers, so you can iterate over them, if you decide to do it that way.

Of course whichever way you do it, you will be faced with the problem of how and where to store the modified connection string. Smile | :)

Good Luck! Smile | :)

Henry Minute

Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”

Questionchecking duplicate value in cell of datagridview Pin
KIDYA9-Jun-09 2:43
KIDYA9-Jun-09 2:43 
AnswerRe: checking duplicate value in cell of datagridview Pin
dan!sh 9-Jun-09 3:24
professional dan!sh 9-Jun-09 3:24 
GeneralRe: checking duplicate value in cell of datagridview Pin
ashwanisihag16-Jun-09 2:26
ashwanisihag16-Jun-09 2:26 
AnswerRe: checking duplicate value in cell of datagridview Pin
ashwanisihag16-Jun-09 2:29
ashwanisihag16-Jun-09 2:29 
Questionsql connection error Pin
Yathish hatter9-Jun-09 2:33
Yathish hatter9-Jun-09 2:33 
AnswerRe: sql connection error Pin
KIDYA9-Jun-09 2:49
KIDYA9-Jun-09 2:49 
GeneralRe: sql connection error Pin
Colin Angus Mackay9-Jun-09 3:04
Colin Angus Mackay9-Jun-09 3:04 
AnswerRe: sql connection error Pin
EliottA9-Jun-09 2:51
EliottA9-Jun-09 2:51 
QuestionHow use DLL file Pin
nguyentuanan19849-Jun-09 2:26
nguyentuanan19849-Jun-09 2:26 
QuestionIE gets hanged when it is navigated through a URL? Pin
svt gdwl9-Jun-09 2:08
svt gdwl9-Jun-09 2:08 
Questionabout Visual C++, C#, J#, VB.net and F# Pin
Seraph_summer9-Jun-09 2:03
Seraph_summer9-Jun-09 2:03 
AnswerRe: about Visual C++, C#, J#, VB.net and F# Pin
saanj9-Jun-09 2:15
saanj9-Jun-09 2:15 
AnswerRe: about Visual C++, C#, J#, VB.net and F# Pin
Nagy Vilmos9-Jun-09 2:18
professionalNagy Vilmos9-Jun-09 2:18 
AnswerRe: about Visual C++, C#, J#, VB.net and F# Pin
Eddy Vluggen9-Jun-09 6:58
professionalEddy Vluggen9-Jun-09 6:58 
QuestionEvent for checkbox click on datagridview. Pin
deepseeindeepsy9-Jun-09 1:53
deepseeindeepsy9-Jun-09 1:53 
AnswerRe: Event for checkbox click on datagridview. Pin
dan!sh 9-Jun-09 3:17
professional dan!sh 9-Jun-09 3:17 
GeneralRe: Event for checkbox click on datagridview. Pin
deepseeindeepsy9-Jun-09 19:57
deepseeindeepsy9-Jun-09 19:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.