Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
285 views
in Technique[技术] by (71.8m points)

c# - How to create a connectionstring without using the admin

I want to connect to my database from my website without using an admin account. I would prefer a user with a role that has limited access CRUD and Procs but without the ability to modify much else.

  • I am using SQL Server.
  • I am building everything in C#.NET.
  • I am using SQL Server Object Explorer and T-SQL to manipulate the database.

I can create a user and password in the DatabaseServer.Security folder.
But I can only create a role in the DatabaseServer.Databases.MyDatabase.Security I can only assign a user created in the DatabaseServer.Databases.MyDatabase.Security to this role.

The users in the DatabaseServer security have a password but those in the Database.Security don't seem to have a password (or way to login).


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You need to map a login to a user.

ALTER USER <your user name>
           WITH login = <your login name>;

For more information see the documentation.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...