Connecting to SQL Server with a username and passw

2019-08-08 03:24发布

I am writing a C# application to be deployed on another machine. The deploy machine is a clean Windows 7 install.

On my development machine (A Windows 7 32 bit Virtual Machine) I have installed SQL Server 2008 R2 and Visual Studio Express 2010. I would like to create a new database and have it require authentication from an application to connect. All the tutorials that I find mention breeze over the connection string part, I cannot find this explained anywhere. In fact, I cannot even figure out how to add a new user and password to SQL Server in SQL Server Management Studio.

How do I add a new user and password to SQL Management Studio 2008 R2 such that I can easily install another SQL Server instance on another machine and move the database to it?

Thanks.

2条回答
我想做一个坏孩纸
2楼-- · 2019-08-08 03:49
混吃等死
3楼-- · 2019-08-08 03:59

first check the authentication mode of your DB: connect to your DB on SSMS, right click it, go to "properties" and then "security". Make sure that "SQL Server and windows authentication mode" is selected. That will allow you to create logins.

Then create your login: connect to your DB on SSMS, expand your database then go to "security" and right click on logins and then click "new login"

then create your user: go to the security folder inside your DB, right click users and "new user". Inform the user name and the login name you previous created. Dont forget to add the necessary permissions

About connection strings, this is a very good website as already pointed:

http://www.connectionstrings.com/
查看更多
登录 后发表回答