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

相关推荐
小码编匠16 分钟前
WPF 多线程更新UI的两种实用方案
后端·c#·.net
xhbh66631 分钟前
MySQL数据导出避坑指南:如何选择正确的工具并设计安全的备份策略?
数据库·mysql·oracle·程序员·mysql导出数据库
幻奏岚音37 分钟前
《数据库系统概论》第一章 初识数据库
数据库·算法·oracle
蜗牛~turbo43 分钟前
金蝶云星空 调价表取历史价格
java·数据库·sql·c#·database
jc06201 小时前
4.1-中间件之Redis
数据库·redis·中间件
Elastic 中国社区官方博客1 小时前
介绍 Python Elasticsearch Client 的 ES|QL 查询构建器
大数据·开发语言·数据库·python·elasticsearch·搜索引擎·全文检索
TG_yunshuguoji1 小时前
阿里云国际代理:云数据库RDS及上云方案
服务器·数据库·阿里云·云计算
FOLLOW ME3111 小时前
MySQL集群高可用架构
数据库·mysql·架构
TG_yunshuguoji1 小时前
阿里云国际代理:稳定、高效、便捷的数据库服务-云数据库RDS
运维·服务器·数据库·阿里云·云计算
danns8882 小时前
neo4j数据库创建范例(SQL文)
数据库·sql·neo4j