Note that there are some explanatory texts on larger screens.

plurals
  1. POwrite string 0'-1" into sqlite android database
    primarykey
    data
    text
    <p>I cant seem to get this right so I am asking what am I overlooking in my code. here's what I've got in my code:</p> <pre><code>newLeaseData = "INSERT INTO " + enterLogLN + " (Date, " + "StockTank1Ft, StockTank1Inch, StockTank2Ft, StockTank2Inch, " + "StockTank3Ft, StockTank3Inch, StockTank4Ft, StockTank4Inch, " + "Change1, Change2, Change3, Change4) VALUES " + "(" + today + ", '" + valueT1Ft + "', '" + valueT1Inch + "', '" + valueT2Ft + "', '" + valueT2Inch + "', '" + valueT3Ft + "', '" + valueT3Inch + "', '" + valueT4Ft + "', '" + valueT4Inch + "', " + difTotalT1 + ", " + difTotalT2 + ", " + difTotalT3 + ", " + difTotalT4 + ")"; </code></pre> <p>everything works until I get to strings: difTotalT1, difTotalT2, difTotalT3 and difTotalT4. each string is set to something like: 0'-1" , 0'-2" , 0'-3" or 0'-4" and when I try to exec the command:</p> <pre><code>myDataBase.execSQL(EnterLogDataOilActivity.newLeaseData); </code></pre> <p>my app crashes with this logcat error:</p> <p>06-05 04:36:23.824: E/AndroidRuntime(1127): android.database.sqlite.SQLiteException: near "'-1", 0'": syntax error: INSERT INTO about (Date, StockTank1Ft, StockTank1Inch, StockTank2Ft, StockTank2Inch, StockTank3Ft, StockTank3Inch, StockTank4Ft, StockTank4Inch, Change1, Change2, Change3, Change4) VALUES ('05_05_12', '0', '1', '0', '2', '0', '3', '0', '4', 0'-1", 0'-2", 0'-3", 0'-4")</p> <p>thanks for the help I know it has got to be something simple. I have also tried inclosing each difTotalT1 string with a single quote but that does not work either (ie difTotalT1 = "'" + difTotalT1 + "'";)</p> <p>this is the string I used to create the table in sqlite:</p> <pre><code>newLeaseTable = "create table '" + leaseName + "' (_id integer primary key autoincrement," + " Date TEXT, StockTank1Ft NUMERIC, StockTank1Inch NUMERIC," + " StockTank2Ft NUMERIC, StockTank2Inch NUMERIC, StockTank3Ft NUMERIC," + " StockTank3Inch NUMERIC, StockTank4Ft NUMERIC, StockTank4Inch NUMERIC," + " Change1 TEXT, Change2 TEXT, Change3 TEXT, Change4 TEXT, User TEXT);"; </code></pre>
    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.
 

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