Urgent Help SQL Express WebConfig or Connection String Error

Discussion in 'Databases' started by bizoso, Dec 6, 2007.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. Hi im very new to site publishing and Im receving the notorious error 26
    System.Data.SqlClient.SqlException: An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)


    This is my connectionstring
    <connectionStrings>



    <add name="SHC_Connection" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\ASPNETDB.MDF;Integrated Security=True;User Instance=True"


    providerName="System.Data.SqlClient" />


    </connectionStrings>


    Do I have to configure or change this string, if so what is the correct syntax. I already add the sql add on and attached my database file. Also uploaded the app_data folder from the root of the site to the ftp server at discountasp. Please I need dummy proof steps.
     
  2. You can't use the Express DB here. (It can be migrated however.)
    Either a SQL Server is needed or you can use an Access DB.
    Well, for a lot of ASP.NET uses you can also use XML files for data.

    Just mention which way you want to go and several of us can help you do it.
    Salute,
    Mark
     
  3. Thanks I just needed to change the data source in the connection string and in the code worked like
    a charm.

    Hope u can help some other time too!!
     
  4. Bruce

    Bruce DiscountASP.NET Staff

    I think Bizosofixed this by updating the connection string to point to our SQL 2k5 server after he attached the database.

    Bruce

    DiscountASP.NET
    www.DiscountASP.NET
     
  5. Wow, hope Bruce can chime in on this.
    It has been my understanding that we can't hit a disconnected SQL Server DB.
    Salute,
    Mark
     
  6. I have the same problem.
    So how to point to SQL 2k5?
    I tried to change the code like this:

     
  7. Your connection string should look as follows:

    <connectionStrings>
    <remove name='LocalSqlServer' />
    <add name='LocalSqlServer' connectionString='Data Source=DBServerName;Integrated Security=false;Initial Catalog=DBName;User ID=DBLogin;Password=DBPassword' providerName='System.Data.SqlClient' />
    <add name='PapersDBConnectionString' connectionString='Data Source=DBServerName;Integrated Security=false;Initial Catalog=DBName;User ID=DBLogin;Password=DBPassword' providerName='System.Data.SqlClient' />
    </connectionStrings>

    Replace the DBName,DBLogin,DBPassword by appropriate values(See your DASP control panel>MS SQL 2005 for more information)

    And btw , MS SQL 2005 is any day preferred over MS Access due to its features and ease of use.

    Vikram

    DiscountASP.NET
    www.DiscountASP.NET
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page