ConnectionString for another PC

Posted on 2007-10-19
Last Modified: 2010-03-19
I've got application that works fine on development PC.  Its server name is \PC144\SQLExpress.  The ConnectionString is programmed in it seems to the application config / XSD file by visual studio automatically.

The server name on target pc could be anything e.g. PC192\SQLExpress.

What does one do to cater for this?  I thought if the Database NAME in both systems were same it would be OK ???

Question by:rwallacej
    LVL 12

    Expert Comment

    Do you received some error?
    If your connection string is in configuration file just change server name and if needed database name and it is ready.

    LVL 18

    Accepted Solution

    if you are always referencing a LOCAL server, use .


    assuming instance name is always the same

    LVL 5

    Assisted Solution

    HI There,

    When you add a database connection to visual studio the connection string is created for you. You are probably using incorrect credentials.Check this url it gives you all of the connection strings that you could ever imagine.


    Author Comment

    patrikt - there doesn't seem to be a config file in the build, only .exe, .pdb etc

    gbshahag - I'll try this
    LVL 12

    Assisted Solution

    OK, you probably used hadcoded string in your Connection object.
    You can simply edit ConnectionString proerty before first connection open. It is up to you where you store actual server name.
    Your program has to supply working connection string before first connection open.

    Author Comment

    gbshahag :
    works, thank-you

    patrikt :
    I have awarded points for your contribution too


    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Join & Write a Comment

    Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
    In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    732 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    25 Experts available now in Live!

    Get 1:1 Help Now