CSqlDataProvider Undefined index: id

When using CSqlDataProvider and you see this error:

Undefined index: id

please remember to set the CSqlDataProvider property keyField

Defaults to ‘id’ and this might not exist or might not be appropriate inside your sql statement