Well better than the 40 days that the last chapter took but C09 went across to Richard today. 44 pages of SqlDataSource, GridView, DetailsView and FormView. With a little bit of validation thrown in.
C08 covered updating the database in code and C09 could dive straight in and just get on with it. The INSERT, UPDATE and DELETE statements had been covered previously so no worrying about them.
Whilst writing the code examples for the chapter I did hit several brick walls. The new controls are good for what they do and they're certainly a lot better than the old DataGrid but they're still not perfect.
The example database design has a many-to-many relationship between a Player and a Format table via a WhatPlaysWhatFormat table. A Player (and mp3 player) supports several different Formats and each Format can be supported by more than one Player.
But how do you handle that? You can't easily (or more correctly I gave up trying to do it). What I really needed was a nice Field control called ManyToManyField that did everything for you - worked out what the potential options were, what the actually selected options were and then dealt with passing all of that back to the database (think about it, there are four queries needed).
I feel a potential article coming on - but must get 2nd drafts and copy edits done first.
Thursday, January 05, 2006
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment