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

相关推荐
我是苏苏2 小时前
C#基础:Winform桌面开发中窗体之间的数据传递
开发语言·c#
sun0077002 小时前
mysql索引底层原理
数据库·mysql
workflower5 小时前
MDSE和敏捷开发相互矛盾之处:方法论本质的冲突
数据库·软件工程·敏捷流程·极限编程
Tony小周5 小时前
实现一个点击输入框可以弹出的数字软键盘控件 qt 5.12
开发语言·数据库·qt
lifallen5 小时前
Paimon 原子提交实现
java·大数据·数据结构·数据库·后端·算法
Favor_Yang5 小时前
SQL Server通过存储过程实现HTML页面生成
前端·信息可视化·sqlserver·存储过程
TDengine (老段)6 小时前
TDengine 数据库建模最佳实践
大数据·数据库·物联网·时序数据库·tdengine·涛思数据
Elastic 中国社区官方博客6 小时前
Elasticsearch 字符串包含子字符串:高级查询技巧
大数据·数据库·elasticsearch·搜索引擎·全文检索·lucene
Gauss松鼠会6 小时前
GaussDB应用场景全景解析:从金融核心到物联网的分布式数据库实践
数据库·分布式·物联网·金融·database·gaussdb
守城小轩7 小时前
Chromium 136 编译指南 - Android 篇:开发工具安装(三)
android·数据库·redis