代码正确,可为什么一直无法连接到数据库,高手请看
我在用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
这是为什么?