実はデータの書き戻しはまだやったことが無いので、トライする。とりあえずは、CommandBuilderで作らせて見た。まずはDelete文。
DELETE FROM MessageTable WHERE ( (JobCategoryID = ?) AND (MessageType = ?) AND (MessageID = ?) AND ( (? = 1 AND Message IS NULL) OR (Message = ?) ) AND ( (? = 1 AND Caption IS NULL) OR (Caption = ?) ) AND ( (? = 1 AND ButtonType IS NULL) OR (ButtonType = ?) ) AND ( (? = 1 AND IconType IS NULL) OR (IconType = ?) ) AND ( (? = 1 AND DefaultButton IS NULL) OR (DefaultButton = ?) ) AND ( (? = 1 AND Notes IS NULL) OR (Notes = ?) ) )
なんだこりゃ? 次はInsert文。
INSERT INTO MessageTable ( JobCategoryID , MessageType , MessageID , Message , Caption , ButtonType , IconType , DefaultButton , Notes ) VALUES ( ? , ? , ? , ? , ? , ? , ? , ? , ? )
こっちは判る。「?」のところにはパラメータが入り、各フィールドの値が設定されるのだろうが...。前者については、パラメータの内容も見てみないと何がなんだかわからない。Update文も見てみよう。
UPDATE MessageTable SET JobCategoryID = ? , MessageType = ? , MessageID = ? , Message = ? , Caption = ? , ButtonType = ? , IconType = ? , DefaultButton = ? , Notes = ? WHERE ( (JobCategoryID = ?) AND (MessageType = ?) AND (MessageID = ?) AND ( (? = 1 AND Message IS NULL) OR (Message = ?) ) AND ( (? = 1 AND Caption IS NULL) OR (Caption = ?) ) AND ( (? = 1 AND ButtonType IS NULL) OR (ButtonType = ?) ) AND ( (? = 1 AND IconType IS NULL) OR (IconType = ?) ) AND ( (? = 1 AND DefaultButton IS NULL) OR (DefaultButton = ?) ) AND ( (? = 1 AND Notes IS NULL) OR (Notes = ?) ) )
...とまぁ、まじめにやろうかとおもったんだけど、時間が無いので、DataSetに対する「Update」で終わらせてしまった←超サボり。ただ、複数テーブルを含んだDataSetの場合は、全部を手作業でやらないといけない、というように思っていたのだが、できるの?うーん。