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

相关推荐
数研小生1 分钟前
亚马逊商品列表API详解
前端·数据库·python·pandas
洛豳枭薰2 分钟前
MySQL 并行复制
数据库·mysql
无尽的沉默3 分钟前
Redis下载安装
数据库·redis·缓存
czlczl2002092514 分钟前
增删改查时如何提高Mysql与Redis的一致性
数据库·redis·mysql
打工的小王15 分钟前
MySql(二)索引
数据库·mysql
数据知道15 分钟前
PostgreSQL 性能优化:如何提高数据库的并发能力?
数据库·postgresql·性能优化
wengqidaifeng16 分钟前
数据结构(三)栈和队列(上)栈:计算机世界的“叠叠乐”
c语言·数据结构·数据库·链表
数据知道17 分钟前
PostgreSQL性能优化:内存配置优化(shared_buffers与work_mem的黄金比例)
数据库·postgresql·性能优化
静听山水20 分钟前
Redis核心数据结构
数据结构·数据库·redis
流㶡29 分钟前
MySQL 常用操作指南(Shell 环境)
数据库