我在用asp.net连接sqlserver2000数据库时是这样写的:
<%@import namespace="System.Data"%>
<%@import namespace="System.Data.SQLclient"%>
----------
----------
----------
dim sqlcon as new sqlconnection("server=localhost;uid=web;pwd=;database=kaoshi")
sqlcon.open
但出现了这样的错误:
Server Error in '/' Application.
--------------------------------------------------------------------------------SQL Server does not exist or access denied. 
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: SQL Server does not exist or access denied.Source Error: Line 14:         dim sqlcon as new sqlconnection("server=localhost;uid=web;pwd=;database=kaoshi")
Line 15:         sqlcon.open 
这是为什么?

解决方案 »

  1.   

    可能是连接字符串不对吧
    试试这个
    server=xxx;User ID=sa;Password=sa;database=tempdb;Connection Reset=FALSExxx是SQL Server管理器中的服务器名称
      

  2.   

    数据库连接
    http://www.connectionstrings.com/
      

  3.   

    如果是连你自己的SQL的话把localhost换成.就可以了
      

  4.   

    看看你的SqlServer 有没有运行
      

  5.   

    sqlserver的问题吧,看看是不是安装时没有选择混合模式
      

  6.   

    udi换成sa试试,localhost可以写成.,表示本地服务器
      

  7.   

    用.net带的 SqlDataAdapter进行连接,如果成功,可以将自己生成的sqlconnection 连接字符串copy过来。再不行就没有办法了。
      

  8.   

    绝对是管理器设置问题。你查查你的web(用户名)对kaoshi的操作权限。
      

  9.   

    server=localhost;uid=web;pwd=;database=kaoshi把localhost改成.就好了