Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You did not make your question specific enough (what kind of suggestions do you want?, what kind of optimization are you looking for?), so my answer is general in nature:</p> <p>I think your sample could surely qualify for the "<strong>Code Duplicacy award</strong>", if not the kind of code we see on <a href="http://www.codinghorror.com/" rel="nofollow noreferrer">Coding Horror</a>. I cannot believe that you cannot see the amount of duplicated code here!</p> <p>You want suggestions. I will give you a few questions to ponder...</p> <p>For instance:</p> <ul> <li>Why have two separate <code>if</code> constructs if the only difference within them is the value of the column (yes/no) and the method call? </li> <li>Even in the current state, why did you not use <code>if-else</code>? (these are RadioButtons!)</li> <li>Why is the database access code (connection creation, command creation, etc.) repeated at every step? Why is it not extracted into a separate function?</li> <li>Why have two separate Update functions when the only difference is the column name to be updated?</li> <li>What is the use of retrieving the value from the database to your application, incrementing it and then running an Update statement to update the value in the database? Is it not possible to create a stored procedure that directly increments and updates a value in a particular column?</li> <li>The list would go on... but I think I'm going to get some ice-cream just to change the taste in my mouth. </li> </ul>
    singulars
    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.
    1. VO
      singulars
      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