Click here to Skip to main content
15,886,075 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,
I have a main database that is created programmatically.In my program Admin user can copy and rename this database.Then admin must alter this new database and grant all of the permissions to guest user with running a sql query, but recieve this error : "The server principal 'UserName' is not able to access to database 'MyDBName' under the current security context".
please help me.

Thanks in Advance.
Posted
Updated 21-May-11 1:55am
v2
Comments
R. Hoffmann 22-May-11 9:13am    
Can you provide details on what kind of database you're using? Is it Access?
mphoenixe 23-May-11 1:13am    
No, I use sql database.the database was created by a normal user and now admin wants to alter it.
Maciej Los 24-May-11 12:02pm    
Probably 'UserName' already exists in 'MyDbName' database as 'MyDbName' user and 'MSSQLServer' user.
Remove 'MyDbName' user and edit 'MSSQLServer' permissions/properties for 'UserName'.
Amir Mahfoozi 11-Dec-11 3:12am    
May disconnecting and reconnecting on the application side , help you.

1 solution

 
Share this answer
 
Comments
Monjurul Habib 11-Dec-11 7:56am    
nice link 5!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900