MS SQL Server - How to find a connection string

Posted on 2008-11-18
Last Modified: 2012-05-05
I've got SQL Server 2005 Express installed on my computer and am trying to figure out what the connection string would be that I need to use in order to connect to it from an ASP.NET application.  I known that I cannot connect to a SQL Server Express database over a network from a different computer, but I want to be able to connect to it locally as part of a testing environment.

Is there a way in SQL Server Management Studio that I can find out what the connection string would be to a particular database?
Question by:josephdaviskcrm
    LVL 18

    Expert Comment

    Hello josephdaviskcrm,

    Look at


    LVL 4

    Accepted Solution

    If server is in local simply use .
    connectionString="Data Source=<servername>\SQLEXPRESS;Initial Catalog=<database name>;User ID=sa;Password=<pwd>" providerName="System.Data.SqlClient" />
    Or you can create a empty aspx page. Drag and drop SQLDataSource from Toolbox->Data click on New connection follow the wizard which will generate the connection string for u.
    LVL 20

    Expert Comment

    by:Marten Rune
    Not your question but...
    Quote: "I known that I cannot connect to a SQL Server Express database over a network from a different computer"

    This opinion of yours needs to be updated. Of course you can connect to a SQL Express from another computer. It's just not on by default.

    Go to: Programs/Microsoft SQL.../Configuration tools/SQL Server Configuration manager
    Enable TCP/IP, and if you like Named pipes (needs a really stable and fast network).
    I often exclude the named pipes


    Author Comment

    That connection string you provided doesn't seem to work.  When I try to set up a connection with the SqlDataSource web control, the wizard says that it is able to connect to the database when I click on 'test connection', but when I hit ok to finalize it Visual Studio throws an error and I am never able to see the connection string.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
    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.
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    This video discusses moving either the default database or any database to a new volume.

    755 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

    16 Experts available now in Live!

    Get 1:1 Help Now