http://www.csdn.net/Develop/read_article.asp?id=16437

解决方案 »

  1.   

    首先先确认你的数据库服务器名是否正确,
    有的时候localhost是错误的"server=localhost;database=Exam;uid=sa;pwd=123;"
      

  2.   

    我改成这样也不行
    <%@ Page Language="C#" ContentType="text/html" ResponseEncoding="gb2312" %>
    <%@ Import Namespace="System.Data"%>
    <%@ Import Namespace="System.Data.SqlClient"%>
    <script runat="server">
    SqlConnection nwindConn = new SqlConnection("server=fileserver;database=Northwind;Uid=zc;Pwd=zc;");
    nwindConn.Open();
    </script>
    <%
    Response.Write ("数据库状态<br>");
    Response.Write (nwindConn.State.ToString());
    %>数据库服务器名是 FILESERVER (MSSQL2000标准版)