我在用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
这是为什么?
<%@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
这是为什么?
试试这个
server=xxx;User ID=sa;Password=sa;database=tempdb;Connection Reset=FALSExxx是SQL Server管理器中的服务器名称
http://www.connectionstrings.com/