views:

210

answers:

1

I am running a Sql statement similar to the following inside of a cleanup method of a unit test in Visual Studio 2008:

DELETE FROM MyTable WHERE EmployeeID = @EmployeeID AND UserID = @UserID ... @EmployeeID & @UserID are assigned appropriate values via parameters in an SqlCommand and ExecuteScalar() is called to execute the statement.

I am receiving DELETE permission denied on object 'MyTable' SqlException when I run this.

Delete permissions have been granted to the user that my SqlConnection connects with, and I can't find any reason that I should be receiving this exception. I am successfully running a similar delete statement on another table in the same database with the same login credentials.

Any help is greatly appreciated. Thanks

+1  A: 

do you have any database triggers associated with this table, when a record is deleted the trigger tries to delete something from another table? (this other table not having the appropriate user rights)

Phill