吾爱破解 - LCG - LSG |安卓破解|病毒分析|www.52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 399|回复: 14
收起左侧

[经验求助] 关于使用Visual studio链接Sql Server数据库一直提示登录失败的问题

[复制链接]
15198743250 发表于 2023-6-6 19:24
25吾爱币
有没有大佬知道这个要怎么解决的?
关于使用Visual studio链接Sql Server数据库一直提示登录失败的问题



报错:
System.Data.SqlClient.SqlException
  HResult=0x80131904
  Message=用户 'sa' 登录失败。
  Source=.Net SqlClient Data Provider
  StackTrace:
   at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, DbConnectionPool pool, String accessToken, Boolean applyTransientFaultHandling, SqlAuthenticationProviderManager sqlAuthProviderManager)
   at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)
   at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions)
   at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
   at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
   at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)
   at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection)
   at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
   at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
   at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
   at System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry)
   at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)
   at System.Data.SqlClient.SqlConnection.Open()
   at WindowsFormsApplication2.DataBase.Connection(SqlConnection conn) in D:\USER\RuningData\20230606\机试作业\国产热剧信息查询\WindowsFormsApplication2\WindowsFormsApplication2\class\DataBase.cs:line 27
   at WindowsFormsApplication2.DataBase.sqlQuery(String sql) in D:\USER\RuningData\20230606\机试作业\国产热剧信息查询\WindowsFormsApplication2\WindowsFormsApplication2\class\DataBase.cs:line 48
   at WindowsFormsApplication2.Form1..ctor() in D:\USER\RuningData\20230606\机试作业\国产热剧信息查询\WindowsFormsApplication2\WindowsFormsApplication2\Form1.cs:line 17
   at WindowsFormsApplication2.Program.Main() in D:\USER\RuningData\20230606\机试作业\国产热剧信息查询\WindowsFormsApplication2\WindowsFormsApplication2\Program.cs:line 19

最佳答案

查看完整内容

命令都成功了,你回到昨晚的版本,再执行程序看看还是登录失败的错误吗

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

px307 发表于 2023-6-6 19:24
15198743250 发表于 2023-6-7 17:06
两个命令运行了都是显示这样的

命令都成功了,你回到昨晚的版本,再执行程序看看还是登录失败的错误吗
 楼主| 15198743250 发表于 2023-6-6 19:26
px307 发表于 2023-6-6 19:52
 楼主| 15198743250 发表于 2023-6-6 20:31
px307 发表于 2023-6-6 19:52
https://blog.csdn.net/yangzijiangtou/article/details/113866906

一直是混合模式的
hrh123 发表于 2023-6-6 21:08
首先应该检查VS和SQLServer本身的,问题,如果按楼主说的已经启用了SQLServer验证方式,那么应检查是否有有效的SSL证书,可以在VS和SQLServer的管理界面内调试.当然,根据报错信息,我认为最有可能是用户名或密码错了,或者是没有数据库的权限,建议楼主确认一下.如果问题还没解决,可以看一下微软的文档来定位具体错误https://learn.microsoft.com/en-us/troubleshoot/sql/database-engine/connect/network-related-or-instance-specific-error-occurred-while-establishing-connection
px307 发表于 2023-6-6 22:35
15198743250 发表于 2023-6-6 20:31
一直是混合模式的

你的问题是新出来的?以前是正常的吗?数据库重启了吗?
 楼主| 15198743250 发表于 2023-6-6 22:50
px307 发表于 2023-6-6 22:35
你的问题是新出来的?以前是正常的吗?数据库重启了吗?

重启了,账号密码我百分百肯定是对的
px307 发表于 2023-6-6 23:08
15198743250 发表于 2023-6-6 22:50
重启了,账号密码我百分百肯定是对的

是不是连接串不对呢有加 Integrated Security=False 吗
 楼主| 15198743250 发表于 2023-6-6 23:53
px307 发表于 2023-6-6 23:08
是不是连接串不对呢有加 Integrated Security=False 吗

写没写这个,都是一样报登录失败
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则 警告:本版块禁止灌水或回复与主题无关内容,违者重罚!

快速回复 收藏帖子 返回列表 搜索

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-4-26 00:53

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表