Reputation: 1081
I have an MSAccess database with user level security defined.
I am trying to programatically create a new group in a MSACCESS database using C# ODBC.
This works:
GRANT SELECT, DELETE, INSERT, UPDATE, SELECTSCHEMA, SCHEMA ON CONTAINER Tables TO NewGroup
So does this (obviously by providing TABLE or OBJECT and the objectName):
$"GRANT SELECT, INSERT, UPDATE, DELETE ON {objectType} {objectName} TO NewGroup";
However when I've run these grants, the group still doesn't have open database permission. How can I do this?
I have tried:
GRANT SELECTSCHEMA ON CONTAINER Databases TO NewGroup
But I don't have permission even though I'm using the owner of the database in the connection string.
Upvotes: 1
Views: 259
Reputation: 97101
I can't find this documented anywhere, but specify CONNECT
for the privilege, and apply it ON DATABASE
...
GRANT CONNECT ON DATABASE TO NewGroup
I did not test that with an ODBC connection, but it worked using ADO in Access like this:
With CurrentProject.Connection
.Execute "GRANT CONNECT ON DATABASE TO NewGroup"
End With
So it should work with an OleDb connection.
Upvotes: 1