Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I tried your example using <a href="http://www.zentus.com/sqlitejdbc/" rel="nofollow noreferrer"><em>sqlitejdbc-v056.jar</em></a> and it worked fine, even with using the single quotes.</p> <p><br/> You could rewrite your call to use <a href="http://java.sun.com/javase/6/docs/api/java/sql/Statement.html#executeUpdate%28java.lang.String%29" rel="nofollow noreferrer"><code>executeUpdate</code></a>, but this should not make a difference:</p> <pre><code>int updateCount = stmt.executeUpdate("update 'tableName' set 'fieldName'=1 where userid=1"); </code></pre> <p><br/> Make sure to use <a href="http://java.sun.com/javase/6/docs/api/java/sql/Connection.html#setAutoCommit%28boolean%29" rel="nofollow noreferrer"><code>setAutoCommit</code></a> (should default to <code>true</code> anyway)</p> <pre><code>connection.setAutoCommit(true); </code></pre> <p>or to perform a <a href="http://java.sun.com/javase/6/docs/api/java/sql/Connection.html#commit%28%29" rel="nofollow noreferrer"><code>commit</code></a> explicitely after updating:</p> <pre><code>connection.commit(); </code></pre> <p><br/> Double-check that you are connecting to the right database. If the problem still is not solved, try to perform a <code>SELECT</code> on that record <strong>before</strong> and <strong>after</strong> the update to see if the value has changed.</p> <hr> <p><strong>Original answer</strong>:</p> <p>Have you tried to remove the single quotes around your <code>tableName</code> and <code>fieldName</code>?</p> <p>These would be treated as strings otherwise, which makes no sence. From the <a href="http://www.sqlite.org/lang_expr.html" rel="nofollow noreferrer">documentation:</a></p> <blockquote> <p>A string constant is formed by enclosing the string in single quotes (')</p> </blockquote>
 

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