1

I use Microsoft Visual Studio Professional 2013. I created Database1.mdf in my App_Data folder. By default, it uses integrated Windows authentication. I have no problem connect to this database file, but when I update all file into web space and browse it in browser, it has an error. I think I need to change it to SQL Server authentication instead of integrated Windows authentication.

My questions are:

  1. How can I change it to SQL Server authentication step by step? I want to connect this data file with user name & password.

  2. How to assign user into it?

1 Answer 1

3

You need to attach the database file to your SQL Server:

http://www.youtube.com/watch?v=rhIr9Qf-oHw

Then you create the type of logins you want:

http://www.youtube.com/watch?v=Uh5USR7pymE

You can now detach the database. Your application can use now the new logins. If you change from Windows to User/password your connection will need to say so, something like:

Server=myServerAddress;Database=myDataBase;User Id=myUsername;
Password=myPassword;

I also found this helpful link that describes also the steps:

SQLExpress - How do I set username/password for a sql datafile

Hope this helps.

Sign up to request clarification or add additional context in comments.

1 Comment

If the link for "SQLExpress - How do I set username/password for a sql datafile" helps you please remember to thank @Gabriel as well.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.