连接字符串:server=.;database=PNotice;uid=sa;pwd=happytech
捕捉到 System.Data.SqlClient.SqlException
Message=用户 'sa' 登录失败。
Source=.Net SqlClient Data Provider
ErrorCode=-2146232060
Class=14
LineNumber=65536
Number=18456
Procedure=""
Server=.
State=1
StackTrace:
在 System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception,
Boolean breakConnection)
在 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()
在 System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand
cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler,
TdsParserStateObject stateObj)
在 System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK)
在 System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo
serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout,
SqlConnection owningObject)
在 System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo
serverInfo, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject,
SqlConnectionString connectionOptions, TimeoutTimer timeout)
在 System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection
owningObject, TimeoutTimer timeout, SqlConnectionString connectionOptions, String
newPassword, Boolean redirectedUserInstance)
在 System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity
identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword,
SqlConnection owningObject, Boolean redirectedUserInstance)
在 System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions
options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection)
在 System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection
owningConnection, DbConnectionPool pool, DbConnectionOptions options)
在 System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject)
在 System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection
owningObject)
在 System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)
在 System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection
owningConnection)
在 System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection
outerConnection, DbConnectionFactory connectionFactory)
在 System.Data.SqlClient.SqlConnection.Open()
在 DB_HELP.Sqlhelp.setDefaulConn() 位置 E:\happytech\通知通报
\PNotice\PNotice\DB_HELP\Sqlhelp.cs:行号 186
InnerException:
这里抛出来的:
try
{
conn = new SqlConnection(connnstr);
conn.Open();
}
catch (SqlException e)
{
}
sql2008 ,安全性-》登录名-》sa: 授予连接到数据库引擎, 启用登陆;
服务器右击属性,安全性,启用 sqlserver和windows身份证验证模式
数据库客户端sa登陆没有问题;
程序运行调试一连接就错误
------解决方案--------------------
擦,给帖子移到非技术区去结贴