How to manage SQL Connection after Installation !!! RRS feed

  • Question


    hi all,

    I am writing a windows application with VS2005 with SQL 2005 Express. I am using 2 separate systems for development and testing.

    Each time when i change the machine, i need to rewrite the ConnectionString property to change the SQL Server\Instance.

    Even on deployment, I need to change the SQL Server Instance in .exe.config file, which is i think very disturbing.


    Can anybody help in this matter. Any script to manage the SQL Server Instance name automatically.


    Thanks in advance.


    Wednesday, August 15, 2007 6:45 AM

All replies

  • Depends and really its not much of an issue. infact its a benefit if you store it in a .config file - the user can choose which instance to connect to.


    Which computer is your SQL Server installed on? Which one are you trying to connect to? Development or Test environment?


    Either way I see no problem. Unless the computers are not connected together via router/same domain or P2P, you should be able to still keep the server\instance name and it should work fine as long as the SQL Server instance is accessible.


    1. Where is the SQL Server instance installed on? Which one are you trying to connect to?
    2. Why not have a central location for SQL Server? The Testing environment sounds good and should be placed there, so why not keep the connection string in the config file to point to that?
    3. If you are currently doing the above, what issues do you come across? Refused connection or something else?


    Thursday, August 16, 2007 4:21 AM
  • Thanks ilyas..

    The SQL server is installed on an XP machine and i was trying to run my .net application from the same system..


    1. I was really ignorant about using (local) as a server name. so i was always specifying SERVER\INSTANCENAME in the connection string. Using (local) solved one of my problems.

    2. If in a network, (local)/INSTANCENAME is not working. Do i need to modify the MyExe.exe.config file to update the SQL ServerName?

    What other option do i have, in order to avoid handling .exe.config file?


    Thanks again


    Saturday, August 18, 2007 7:22 AM