Cry about...
MS-Windows Troubleshooting
Server Error in '/<folder>' ... Dynamic SQL generation for the UpdateCommand is not supported ...
Symptom:
When trying to run a .NET web-application that updates a database table, the following error is generated in the browser:
Server Error in '/<folder>' Application
Dynamic SQL generation for the UpdateCommand is not Supported against a SelectCommand that does not return any key column information.
Cause
A record has been retrieved from a database and an attempt has been made to update the record, however the database table lacks a primary key and therefore there is no way to update the required record.
Remedy:
Ensure that a primary key is created on the database table.
If you think that there is a primary key on the table and you are still getting this error then double check that the database confirms that there really is a primary key on the table, because there really isn't a primary key on that table.
The only exception I know to this is if the database is Microsoft-Access. I have seen issues with the framework correctly identifying the primary key for MS-Access when the primary key is not an integer. The work around is to add an auto-increment ID field and make that the primary key instead.
These notes have been tested within Microsoft Visual Studio .NET 2003 running under Windows 2000, Microsoft Visual Studio 2019 runing under Windows 10, and may apply to other versions as well.
About the author: Brian Cryer is a dedicated software developer and webmaster. For his day job he develops websites and desktop applications as well as providing IT services. He moonlights as a technical author and consultant.