This is a migrated thread and some comments may be shown as answers.

Connection string help for SQL Server 2008

1 Answer 180 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Harry
Top achievements
Rank 1
Harry asked on 13 Jun 2011, 05:27 PM
1.  I have downloaded the sample Telerik Sales Dashboard demo site.
2.  I have SQL Server 2008 installed and have the NorthWind database installed also.
3.  When I try to launch the web site using VS2010, I keep getting the error:

static public IObjectScope GetNewObjectScope()
{
Database db = Database();  <-- Error happens here
IObjectScope newScope = db.GetObjectScope();
return newScope;
}

Unable to reach database server on host ''.
Error Details:A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified).


I have tried all of the following connection strings in my web.config (one by one) file but none of them work:


<add name="NorthwindConnectionString" connectionString="Data Source=.\MYCOMPUTERNAME;AttachDbFilename=|DataDirectory|\Northwind.mdf;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient"/>


    <add name="NorthwindConnectionString" connectionString="Data Source=.\MYCOMPUTERNAME;AttachDbFilename=|DataDirectory|\Northwind.mdf;Integrated Security=True" providerName="System.Data.SqlClient"/>


    <add name="NorthwindConnectionString" connectionString="Data Source=MYCOMPUTERNAME;Initial Catalog=Northwind;Integrated Security=True" providerName="System.Data.SqlClient"/>


    <add name="NorthwindConnectionString" connectionString="Server=MYCOMPUTERNAME; Database=Northwind.mdf; Integrated Security=true;" providerName="System.Data.SqlClient" />





What is going wrong here?  What is the correct connection string to use for SQL Server 2008?

1 Answer, 1 is accepted

Sort by
0
Alexander
Telerik team
answered on 16 Jun 2011, 02:54 PM
Hello Harry,

The Sales Dashboard demo is based on the "classic" OpenAccess API, which does not use standard connection strings but the old OpenAccess connection settings format. In the web.config you should have the following section:
    <references>
        <reference assemblyname="Telerik.SalesDashboard.Data" configrequired="True"/>
    </references>
    <connections>
        <connection id="NorthwindConnection">
            <databasename>NorthwindOA</databasename>
            <servername>(LOCAL)\SQLEXPRESS</servername>
            <integratedSecurity>True</integratedSecurity>
            <connectionParams>AttachDbFilename=|DataDirectory|\NORTHWND.MDF</connectionParams>
            <backendconfigurationname>mssqlConfiguration</backendconfigurationname>
        </connection>
    </connections>
</openaccess>

You can just edit the servername tag, so that it matches the name of your SQL Server instance. This should be enough for you to run the demo.

Please note that the demo uses the NorthwindOA database, which is an extended version of Northwind. If you indeed have a NorthwindOA database on your server, you can use it instead of the automatically attached database if you comment out the connectionParams tag from the connection section. I hope that helps.

Regards,
Alexander
the Telerik team
Q1’11 SP1 of Telerik OpenAccess is available for download; also available is the Q2'11 Roadmap for Telerik OpenAccess ORM.
Tags
General Discussions
Asked by
Harry
Top achievements
Rank 1
Answers by
Alexander
Telerik team
Share this question
or