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";

相关推荐
m0_716430072 分钟前
mysql乐观锁更新失败如何处理_应用层重试逻辑编写建议
jvm·数据库·python
qq_654366983 分钟前
SQL嵌套查询中的变量传值_优化存储过程逻辑
jvm·数据库·python
Austindatabases3 分钟前
阿里云MongoDB 部署安全吗? 多可用区怎么搞?
数据库·安全·mongodb·阿里云·云计算
m0_748920366 分钟前
持久化存储如何与后端接口同步?解决本地缓存与数据库不一致痛点
jvm·数据库·python
qq_330037997 分钟前
Python如何安装特定架构包_32位与64位系统兼容性处理
jvm·数据库·python
y = xⁿ11 分钟前
MySQL常见八股:索引
数据库·mysql
希望永不加班13 分钟前
SpringBoot 缓存一致性:缓存与数据库双写策略
数据库·spring boot·后端·缓存·oracle
2401_8836002516 分钟前
Electron 中正确实现主进程异步操作的 Renderer 端回调机制
jvm·数据库·python
草莓熊Lotso22 分钟前
手搓工业级 C++ 线程安全日志系统:基于策略模式解耦,兼容 glog 使用风格
linux·运维·服务器·数据库·c++·安全·策略模式
2402_8548083722 分钟前
c++ RAII机制详解 c++如何利用RAII管理资源
jvm·数据库·python