I have been having issues with this error for a while so I decided to start from a blank solution. I created a project for persistent class using NorthWind, I create a web Service project and did the GetCustomers thing. I created a web app with a RADGrid. This worked. Off to a good start.
Let’s move on to using my own db. Created another persistent class Project that accesses my db make all changes needs and lo and behold I get the invalid object name error. After spending most of the day dinking around with this I renamed one table in the db and created another persistent class project to access the newly renamed table (always using reverse mapping) and this time it worked. What is going on I think to myself.
I spend more time and create more and more persistent class projects on different dbs some work most don’t. Very frustrating!!
Eventually I make a copy of the entire db that I was able to get the one table to work with and rename all the tables to see if that will help... nope same error, including now fo rthe table that did work. I decided to try this. Using the new database which is a backup/restore of the one persistent class example I do have working. I create another persistent class with just the one working table in it. Make all needed changes and nope invalid object name error again. Telerik name had been used in vain many times at this point.
Lets do a diff on the class that works vs the one that doesn’t.
Results of file dff's:
Class.cs is that same except for namespace,
Class.Telerik.OpenAcess.cs same except for namespace
ReverseMapping.cs – same except for the names of other tables in db since I renamed them all.
ObjectScopeProvider.cs – same
App.config same except for namespace.
At this point I can swap the classes in and out of the webService and web app and replicate the issue at will. These are the steps I do to replicate the error: lets us assume Class1 works and Class2 gives us the Invalid Object Name error.
Web Service project
1. Remove Class1 reference
2. Add Class2 reference
3. Update config references
4. Change the using statement to class2
5. Rebuild
Web App project
1. Remove Class1 reference
2. Add Class2 reference
3. Update config references
4. Browse default.aspx get error
Repeat steps to change back to Class 1 and browse default.aspx. No error and RadGrid is populated
At this point Telerik owes me some time and to say I did due diligence on this would be an understatement, Also I have read all I could find in the forums including this one http://www.telerik.com/community/forums/orm/general-discussions/always-getting-error-executing-query-telerik-openaccess-rt-sql-sqlexception.aspx
I am not buying into the config error and it would not explain how I was able to rename the table and then have the issue go away when I first started. As a last resort I did change the connection string in the Class2 to the db in the working Class1 and received the same error. Table name and columns and data for that table are all the same.