Data Binding, Updates, and SQLDataSource

Random Things to remember:

  • SQLDataSource won’t bind parameters properly if you don’t specify a type, but the GUI data source setup window doesn’t guess nor prompt you to provide them. It’s under ‘Advanced’; or go into the code and add them.
  • GridView will automatically add anything with ‘id’ in the field name to the DataKeys list, and anything in the DataKeys list will use the OLD value in parameters even if you bind an edit control to it. Make sure the DataKeys list only includes the primary key(s), NOT any foreign keys!

Have a question?

Your email address will not be published. Required fields are marked *