please help with the newbie error - connecting to the DB (ASP.NET
am 30.10.2004 13:29:01 von kostyantynsalimovI've the following simple page:
===
<%@ Page Language="C#" Debug="true" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
===
When I try to Start the page I got the following error:
===
Server Error in '/' Application.
Named Pipes Provider: The system cannot find the file specified.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information about
the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Named Pipes Provider:
The system cannot find the file specified.
Source Error:
Line 11:
Line 12: SqlConnection myConnection = new
SqlConnection("server=localhost;database=nn;Trusted_Connecti on=Yes");
Line 13: myConnection.Open();
Line 14: }
Line 15:
Source File: f:\study2\site\Default.aspx Line: 13
Stack Trace:
[SqlException (0x80131904): Named Pipes Provider: The system cannot find the
file specified.
]
System.Data.ProviderBase.DbConnectionPool.GetConnection(Obje ct
owningObject) +317
System.Data.ProviderBase.DbConnectionFactory.GetConnection(D bConnectionBase
owningConnection) +90
System.Data.ProviderBase.DbConnectionClosed.Open(DbConnectio nBase
outerConnection) +189
System.Data.ProviderBase.DbConnectionBase.Open() +62
System.Data.SqlClient.SqlConnection.Open() +168
ASP.Default_aspx.Page_Load(Object sender, EventArgs e) in
f:\study2\site\Default.aspx:13
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o,
Object t, EventArgs e) +15
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Obje ct sender,
EventArgs e) +36
System.Web.UI.Control.OnLoad(EventArgs e) +102
System.Web.UI.Control.LoadRecursive() +45
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +952
Version Information: Microsoft .NET Framework Version:2.0.40607.16; ASP.NET
Version:2.0.40607.16
===
I use integrated security for SQL Server Express, database nn exists. OS:
Windows Server 2003. I also ran the following set of commands to grant access
to SQL Server from ASP.NET:
sp_grantlogin 'NT AUTHORITY\NETWORK SERVICE'
sp_grantdbaccess 'NT AUTHORITY\NETWORK SERVICE', 'NS'
grant all privileges on countries to NS
However, I'm able work with database in ASP.NET pages with the wizard-like
tools of Visual Web Developer.
I've tried several types of connection strings, searched through the
documentation but was unable to find a solution. Please help.