MSSQL error permission error

The SELECT permission was denied on the object '....', database '.....', schema 'dbo'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: The SELECT permission was denied on the object '.....', database '.......', schema 'dbo'.
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

Anthony PerkinsConnect With a Mentor Commented:
Word of caution and although this may sound counter intuitive, but doing a GRANT SELECT ON TableName TO ASPUser, may actually not be the best solution.  You are better off including it in a Stored Procedure and doing a GRANT EXECUTE ON StoredProcedureName TO ASPUser.  That is of course if the SELECT is not already in a Stored Procedure and not using Dynamic SQL.
Anthony PerkinsCommented:
That means that the ASP user does not have GRANT SELECT permissions on the table.
Alan WarrenConnect With a Mentor Commented:
Hi shpresa,

Can you log into your the SQL server using SQL Server Management Studio, providing the same credentials as defined in in your web.config connectionstrings?

If so, can you then execute your 'Select' script from within SQl Server Management Studio?

If not, you need to grant some permissions to the user account. To do so, you may need to logout of SQL Server Management Studio and login again using an Admin account, usually named sa, grant the necessary permissions, then logout as 'sa' and log in again using the account credentials defined in your web.config and test that you can now execute your SQL script. After which it should work from your asp .net application too.

All Courses

From novice to tech pro — start learning today.