C# 连接SQLServer操作数据库问题

C#联合SQLServer开发时连接数据库报错connection 连接问题

报错信息:

This operation requires a connection to the 'master' database. Unable to create a connection to the 'master' database because the original database connection has been opened and credentials have been removed from the connection string. Supply an unopened connection.

解决方案:

1、connection配置中加入: Integrated Security=True,表示可以在不知道数据库用户名和密码的情况下,依然可以连接数据库

2、connection配置中加入:Persist Security Info = True,表示数据库连接成功后是否保存密码信息

连接字符串可配置为:string connectionString=@"服务器名称;Database=数据库名称;User Id=用户名称;Integrated Security=True";

相关推荐
小小不董11 分钟前
深入理解oracle ADG和RAC
linux·服务器·数据库·oracle·dba
胚芽鞘6811 小时前
查询依赖冲突工具maven Helper
java·数据库·maven
宇钶宇夕1 小时前
SIMATIC S7-1200的以太网通信能力:协议与资源详细解析
运维·服务器·数据库·程序人生·自动化
LuckyLay1 小时前
1.1.1数据类型与变量——AI教你学Django
数据库·django·sqlite
水果里面有苹果2 小时前
20-C#构造函数--虚方法
java·前端·c#
汤姆大聪明2 小时前
Redis 持久化机制
数据库·redis·缓存
brevity_souls3 小时前
什么是时序数据库?——原理、特点与应用
数据库·时序数据库
SelectDB3 小时前
Apache Doris 实时更新技术揭秘:为何在 OLAP 领域表现卓越?
数据库·数据分析·apache
kk在加油4 小时前
Redis数据安全性分析
数据库·redis·缓存