Every SharePoint developer who has worked with extensively with dataview webpart 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 copy the datasource from a newly created dataview and replace the datasource in the erroneous dataview. Gotcha this worked.  Below are the steps we did

 

1. Create a new page in SharePoint designer.

2. Add a dataview webpart to the new page and set the datasource as the same list or library that the erroneous dataview uses.

3. Switch to the code view.

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

4. Copy the datasource element from the dataview in new page

5. Replace the datasource element of the erroneous dataview with the copied datasource element