The problem is in this line:
connection.mysql.ExecNonQuery("UPDATE tb_pa SET code_unit='" & edittext1.Text & "', type_unit='" & edittext2.Text & "', plan_pa= '" & edittext3.Text & "' WHERE id='" & unitid & "'")
When you update,
unitid is an empty string. Therefore nothing is updated.
Replace the line by this one:
connection.mysql.ExecNonQuery("UPDATE tb_pa SET code_unit='" & edittext1.Text & "', type_unit='" & edittext2.Text & "', plan_pa= '" & edittext3.Text & "' WHERE id='" & Main.id & "'")
Then there are some other mistakes:
1. The DBUtils module is now replaced by a the
DBUtils B4X Library. You should remove the module and use the library.
Download the DBUtils.b4xlib file and copy it to the AdditionalLibraries\B4X folder.
If you don't have yet set the AdditionalLibraries folder structure look at
Additional libraries folder in the B4X Basic Language Booklet.
B4X Libraries are explained
HERE in the same booklet.
Then you might read the B4X Documentation Booklets.
2. Your layouts are not OK. The input_data layout is landscape but the screen is in portrait, therefore parts of the views are outsides the screen in portrait. Take of the text colors.
3. When you click on an item in ListView1 the return value is the first value you entered. You might use the id value as the return value to be unique.
In the click routine you use a For/Next loop, as each entry should be unique there should be only one result therefore no need for the loop.
4. In the database the id field is defined with NUMERIC UNIQUE, this is not a 'standard' data type in SQLite. It would be better to set it as INTEGER PRIMARY KEY.
Then you read it back as a String,
id = connection.mycur.GetString("id"),
you should use an Int variable instead. Declare
id As Int and read it with
id = connection.mycur.GetInt("id").
5. When you go from the input_data Activity back to the Main Activity your program crashes. I changed it in the modified version.
6. For SQLite query results you might use ResultSet instead of Cursor. ResultSet is cross-platform, Cursor is only B4A.
I would suggest you to read the
B4X Documentation Booklets, there exist a specific booklet about SQLite and watch
Erels' video tutorials to get a better knowledge on B4A.
Attached your project with some modifications.