New topic: Relationships and Listboxes - SQL help needed!
<http://forums.realsoftware.com/viewtopic.php?t=30669> Page 1 of 1 [ 1 post ] Previous topic | Next topic Author Message TomHicks Post subject: Relationships and Listboxes - SQL help needed!Posted: Mon Oct 26, 2009 9:31 am Joined: Mon Aug 20, 2007 9:42 am Posts: 122 I have a window which displays a client record. This client record has several items which are in separate tables in order to create relationships. e.g. Code:tblClients (ID integer primary key autoincrement, Name text, Address text) tblContacts (ID integer primary key autoincrement, ClientID integer, Type text, Details text) I then have 3 listboxes on the client window which show the client's Telephone Numbers, Fax Numbers, and Email Addresses. New ones can be added; existing ones can be removed; existing ones can be edited. I don't want any changes committed until the user presses Save (or by closing the window and being asked to save changes) so my strategy is that the CellTag of column 0 contains the ID of the record in tblContacts for existing items, and is -1 for rows I've added which have yet to be saved to the database. The idea is that when the user presses Save, any CellTags which are not -1 trigger an UPDATE statement based, and any CellTags of -1 trigger an INSERT statement. The problem is that if a row is deleted from the listbox, I need to execute the DELETE statements for rows which no longer exist in the listbox. I want to do something like the following: DELETE FROM tblContacts WHERE ID has not just been updated or inserted I could keep an array containing all the CellTags of rows which have been removed, and then run DELETEs on them, but I would like to give this all to SQLite to sort out. Plus, I have a lot of listboxes to which I would like to apply this strategy (quotes, orders, etc.) and would like a nice catch-all line of SQL I can use. Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 1 post ] -- Over 1500 classes with 29000 functions in one REALbasic plug-in collection. The Monkeybread Software Realbasic Plugin v9.3. http://www.monkeybreadsoftware.de/realbasic/plugins.shtml [email protected]
