What am I missing?
The following does not throw any errors but does not update the table either???
B4X:
If Main.SQL1.IsInitialized = False Then Main.SQL1.Initialize(File.DirInternal, "PartsAndTime.db", False)
Main.SQL1.ExecNonQuery("UPDATE TKRecordTemp SET Sent=1, Success=1 WHERE OSID = 101130;")
Tried with and without the debugger.
The Select Queries on the table all work correctly.
If you execute this SQL in a SQL editor (I use the Firefox add-on, but others are available) what happens? Does the code work? Are you sure you need the ; at the end?
Are you really sure that you aren't making the change, but then somehow overwriting the DB, this can be a common issue in code. Especially as you have to copy the DB from Assets to Internal so that you can make changes to it. What does that part of your code look like?
OP, are Sent and Success numerics? They're not defined as char or string are they?
I would execute the SQL as you have it in a SQL Editor on the DB on your machine and see what the result is. That should give you a clue about the problem you are having.
If you execute this SQL in a SQL editor (I use the Firefox add-on, but others are available) what happens? Does the code work? Are you sure you need the ; at the end?
Are you really sure that you aren't making the change, but then somehow overwriting the DB, this can be a common issue in code. Especially as you have to copy the DB from Assets to Internal so that you can make changes to it. What does that part of your code look like?
I know the change is not being made as a subsequent query to retrieve the records finds no records. A query with the old criteria does.
RE. the semicolon. IT is my understanding that a ; on the end is good programming practice. It indicates the end of an SQL statement. As a practical matter for single queries it does seem to make no difference. I have never had it be an issue, and I tried with and without.
Sigh, I figured it out. SQL Lite is not explicitly typed but says it stores things as what they, I guess what that really means is that if you don't specify a type it stores a string. Even though the field is ALWAYS a long when I wrapped it in single quotes it worked
B4X:
WHERE OSID = '101130';
. So I went back and specified the type and it worked as it should. I was in a hurry to get things working and it came back and bit me .