Pregunta

Im using asp.net mvc4 using azure sql-database and I have problem with initial database with the following command:

WebSecurity.InitializeDatabaseConnection("AdminDBConnection", "UserProfile", "UserId", "UserName", autoCreateTables: true);

A exception is thrown saying:

CREATE TABLE permission denied in database 'master'.

And this should be easy to solve knowing that sql have the keyword GRANT that will manage permissions but I cant get it to work.

When i entering:

GRANT ALL 
ON "object_name"
TO "user_name"

Where object_name is my Database and username the user to whom to give access rights to.

I get the following :

Msg 15151, Level 16, State 1, Line 1
Cannot find the object 'object_name', because it does not exist or you do not have permission.

And my question then is:

Does my sql query not work because i have the wrong 'object_name'?

And if so how can i in vs 12 or in the azure portal or in the Connectionstring see my username and database name, so i can give it access rights.

If 'object_name' is not the problem then my question is:

What is the problem and how do i fix it?

Thanks!

¿Fue útil?

Solución

Ok the problem was that I had the wrong connectionstring.

I learned that you can see the connectionstring under Windows Azure management portal, go to SQLDATABASE, select the database and then click on show connectionstrings. This will bring up several connectionstrings you should take the ADO.net connectionstring. I think this is the right one for all asp.net project.

Thanks and sorry for your time.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top