小弟刚学asp.net用的开发工具是微软的
windows 2003server + Visual Web Developer Express + sql2005 Express

练习ado.net连接数据库时遇到难题了,代码如下
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient"%>
<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="connection.aspx.cs" Inherits="_Default" %>
<html>
<head runat="server">
    <title>connection test</title>
    <script language="c#" runat=server>
    public void page_Load(Object sender, EventArgs e)
    {
     //connect to the local database     
    String strConn= "server= (local); database=pubs; uid=sa; pwd=";
            SqlConnection cn=new SqlConnection(strConn);
    //open the connection
    cn.Open(); //提示出错的一行
    //show the status of connection
    Message.Text=cn.State.ToString();
    //close the connection
    cn.Close();
    }
    </script>
    </head>
<body>
    <form id="form1" runat="server">
    <div>
    <asp:label ID="Message" runat=server>Label</asp:label>
    </div>
    </form>
</body>
</html>

调试时提示cn.Open();出错:
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: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)

不知道是何原因,是2003sever权限还是sql权限问题,还是别的问题?
望高手给与指点!多谢!