Alright.. this is particularly tricky considering the SELECT permission denied error and the difficulty of wading through all of the “You need to grant select permissions on your table…” responses. But, we have tried with several accounts, one of which has db owner privileges, and can indeed confirm that SELECT works.
The server itself is 2008 R2, with 2 DB’s. One is running in SQL 2000 compatibility mode, and connecting to that db with MFC works fine.
The second is 2008 compatibility mode, and no matter which user we use to login, or which table we try to access, we receive “The SELECT permission was denied on the object ‘TABLE’, database ‘db’, schema ‘dbo’. The cursor was not declared”
The connection string we are using is:
m_TABLENAME.OpenEx(_T("Driver={SQL Server};Server=0.0.0.0\\instance;Database=db;User=user;Password=password;"), CDatabase::noOdbcDialog)
This is using Visual Studio 2010, dev station is Windows XP, but we also copied the executable to a Win7 machine and received the same error.
It was a connection string issue. “User” and “Password” should be “uid” and “pwd”: