views:

665

answers:

3

Hi,

WHen i try to connect to SQL Express 2005 from Visual Web Developer Express 2008, i was getting errors like 'Could not load file or assembly Microsoft.SqlServer.Management.Sdk.Sfc' .

I read some posts which advised me to download and install 3 applications to address above issue ( SharedManagementObjects.msi, sqlncli.msi,SQLSysClrTypes.msi ).

I did that and now i get a different connection error

'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) '.

Does anyone know a way of overcoming this ?

Thanks.

A: 

How are you trying to connect ? Just a regular ADO.NET connection? If so, what's your connection string?

Are you trying to use SMO (SQL Mgmt Objects)? This sounds like some of your SMO objects aren't available for some reason - you might want to download and reinstall those SMO components from here. The files you want are quite a bit down the page, under the heading of "Microsoft SQL Server 2005 Management Objects Collection" - files are called "SQLServer2005_XMO.msi" (with some x64 variations).

Does installing that MSI help at all?

Marc

PS: okay, thanks, based on your comment - can you try this connection string here:

string connectionString = @"Server=.\SQLEXPRESS2005;Database=DBName;Integrated Security=SSPI";
marc_s
My connection string is string connectionString = @"Data Source=ELDORA-08401090\SQLEXPRESS2005;Initial Catalog=DBName;Integrated Security=True;";I installed the above MSI and i still get the error
Chakra
No. I tried with the connectionstring you suggested but it gave the same error. Thanks.
Chakra
OK thanks - the error must be elsewhere - hmm.....
marc_s
I converted the web site to a web application and it worked out. I presume it was the download u suggested that did it. Thanks.
Chakra
A: 

If you are running SQL Sever Express locally another thing you may want to do check in the Services console (WinKey, Run, 'services.msc') and verify that you have SQL Server and SQL Server Agent entries and that they are both running.

Gary.Ray
A: 

I think this problem is certainly with your connection string. Try doing this

  1. Run the SQL Management Express, and get the server instance name from it.

Usually this problem occurs when the server instance name is wrong (on many computers it could be SQLEXPRESS).

Cyril Gupta
in my case the instance name is SQLExpress2005 and that is what i use in the connectionstring
Chakra