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