We help IT Professionals succeed at work.

Change Database permission to Read/Write using Visual Studio 2010

dshrenik
dshrenik asked
on
809 Views
Last Modified: 2012-05-10
Please let me know how one can change a database's permissions to read/write using queries, in Visual Studio 2010.

If possible, please give me the step by step procedure.
Thanks!
Comment
Watch Question

Commented:
Hi,

You should have the corresponding rights and launch following query :

ALTER DATABASE mydatabase READ_WRITE


Good luck !

Author

Commented:
Please let me know where (in Visual Studio 2010) I can execute this query.
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
Can't I execute the query using Visual Studio 2010? I remember someone saying in a forum that it can be done. Maybe he's wrong. Please let me know.

Author

Commented:
Also, does it come bundled with Visual Studio 2010 installation?
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
Yeah.. I figured that out. But, I'm not sure how to proceed from there. Where exactly do I enter the query and how do I run it?

Commented:
you type the query I gave you, you click on Execute.

but if you wonder those kind of thing, I guess you don't have the rights to do it.

Author

Commented:
I'm sure I have the permissions.

I right click on the database name under, Data Connections, and then say 'New Query', and it then shows me a list of tables. Here's where I'm not sure what to do.
Even if I select some random tables, and enter the query, I don't see any 'Execute' button or option.
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
Thanks for the link.

When I try to execute "ALTER DATABASE ASPNETDB.MDF READ_WRITE", it says "Msg 102, Level 15, State 1, Line 1
Incorrect syntax near '.'."

"ALTER DATABASE ASPNETDB READ_WRITE" does not woek as well.

Commented:
1) is ASPNETDB your database to alter ?
2) what is error for 2nd statement ?

Author

Commented:
Yes. That is the default database created by Visual Studio for an website.

I get the following error for the second statement:
"Msg 102, Level 15, State 1, Line 1
Incorrect syntax near 'READ_WRITE'."
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
When I execute "ALTER DATABASE ASPNETDB SET READ_WRITE", I get the following error:

The database has been created by me and I am the administrator on my laptop. So what could the problem be?
Msg 5011, Level 14, State 5, Line 1
User does not have permission to alter database 'ASPNETDB', or the database does not exist.
Msg 5069, Level 16, State 1, Line 1
ALTER DATABASE statement failed.

Open in new window

Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
Sorry to ask too many questions, but can you tell me how I can do that?
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
I guess I do not have an SQL Server account. Could you tell me how I can create one?
Apologies again, for asking too much!

Commented:
you said you created the database, you have been asked to input an administrator password.

use login = "sa" and password = "yourpassword"

to go ahead, I advise you log on the server itself and user SQL Server Management Studio, you'll get a better view of the server.

Author

Commented:
Well, I did not create the database myself. It was created automatically by Visual Studio 2010 when my website was launched.

I do not have  SQL Server Management Studio installed. Does it come bundled with Visual Studio 2010?
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
aspnetdb.mdf is not readonly.

I have attached a screenshot of the results.
DB.png

Author

Commented:
I'm not clear with 1 thing - say I have several .MDF files on my computer, how do I select a particular instance to apply queries on?
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
Thank you! :)

Author

Commented:
Another useful link - Walkthorugh to create and execute Transact-SQL script:
http://msdn.microsoft.com/en-us/library/aa833241.aspx

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.