Getting Rid of The Server Returned a Non-Specific Error in SharePoint Designer

Every SharePoint developer who has worked with extensively with data view web part in SharePoint Designer would have encountered the below misleading error at least once

“The server returned a non-specific error when trying to get data from the data source. Check the format and content of your query and try again. If the problem persists, contact the server administrator.”

There are several solutions out there in the web for this error like the ones listed below but none of them are sure shot fixes

http://blogs.msdn.com/spdsupport/archive/2008/06/06/how-to-fix-error-unable-to-display-this-web-part-on-data-views-after-restoring-site-from-backup.aspx

After having tried out several solutions with no luck we tried to copy the data source from a newly created data view and replace the data source in the erroneous data view. Gotcha this worked.  Below are the steps we did,

1. Create a new page in SharePoint designer.

2. Add a data view web part to the new page and set the data source as the same list or library that the erroneous data view uses.

3. Switch to the code view.

3. Open the page with the erroneous data view in code view mode.

4. Copy the data source element from the data view in new page

5. Replace the data source element of the erroneous data view with the copied data source element