Note that there are some explanatory texts on larger screens.

plurals
  1. POWhat is the best way to update SQL Server CE table?
    primarykey
    data
    text
    <p>I have 2 tables.<br/> Table <strong>Movie</strong><br/> - id (PK)<br/> - title<br/> - type<br/> <br/> Table <strong>Episode</strong><br/> - id (PK)<br/> - episode (PK)<br/> - title<br/> <br/> Each Movie has some Episodes.<br/> <br/> <strong>Movie</strong><br/></p> <pre><code>--------------------------------- | id | title | type | |----|-------------|------------| | 1 | movie1 | 3 episodes | | 2 | movie2 | 2 episodes | --------------------------------- </code></pre> <p><br/> <strong>Episode</strong><br/></p> <pre><code>---------------------------------------- | id | episode | title | |----|-------------|-------------------| | 1 | 1 | movie1 episode 1 | | 1 | 2 | movie1 episode 2 | | 1 | 3 | movie1 episode 3 | | 2 | 1 | movie2 episode 1 | | 2 | 2 | movie2 episode 2 | ---------------------------------------- </code></pre> <p><br/> If I update record id="1" (on both table), I often use:<br/> Table <strong>Movie</strong>:</p> <pre><code>Update Movie set title='...', type='...' where id=1; </code></pre> <p>Table <strong>Episode</strong></p> <pre><code>Delete from Episode where id=1; Insert into Episode(id, episode, title) values('...', '...', '...'); </code></pre> <p>I think it's a stupid way to update Table Episode. I just can't think another way to update the record consider user may change, add, or delete some record on table and then save all change to database.</p> <p>Anyone have another solution?</p> <p><strong>EDIT:</strong></p> <p>ex. User do some change on Table Episode (just id=1)<br/> <strong>Episode</strong><br/></p> <pre><code>---------------------------------------- | id | episode | title | |----|-------------|-------------------| | 1 | 1 | movie1 episode 1 | | 1 | 2 | movie1 episode 1a | | 1 | 3 | movie1 episode 2 | | 1 | 4 | movie1 episode 3a | | 1 | 5 | movie1 episode 3b | ---------------------------------------- </code></pre> <p>How can I store all that change to database?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload