[SOLVED] Project does not update data in SQLite table - Forum

Forum Navigation
You need to log in to create posts and topics.

[SOLVED] Project does not update data in SQLite table

I am a beginner and am trying to learn how to use VisualNeo Win. I take my cue from the various tutorials to try to get to my goal.

I would like to create a small address book, at the moment locally.

I can read the data from the database, but if I make a change to the record via an input container, I cannot store the changes.

Where do I go wrong?

Thank you in advance for any suggestions.

Uploaded files:
  • You need to login to have access to uploads.

@damasiciccio please check this included sample app (look under MyDocuments\visualneoweb\sample apps\neoPhpSamples folder in your computer) :
https://visualneo.com/tutorials/neotabledb/
User: admin
Pass: admin

Damasiciccio has reacted to this post.
Damasiciccio

Thank you luishp,

I have solved it. I indicate below the solution I found because it was not explicitly stated in the various tutorials.

Simply, in the command

neoPhpExecSql "AliasArchiveDB" "updateRubric" "[SURNAME]::[NAME]::[DEPARTMENT]::[TEL1]::[TEL2]::[TEL3]::[TEL4]::[REFERENT]::[ID]" "saveRubric"

the order of the fields must be the same as those appearing in the SQL query, in the same sequence.

luishp has reacted to this post.
luishp

Hi @damasiciccio

There are several problems.
1 in config.php the update is $sqlQuerys[1]="UPDATE RUBRICA SET COGNOME = ?, NOME = ?, REPARTO = ?, TEL1 = ?, TEL2 = ?, TEL3 = ?, TEL4 = ?, REFERENTE = ? WHERE ID = ?";

2 In pushbuttonSave ID must be the last member to match the update query:
neoPhpExecSql "AliasArchivioDB" "updateRubrica" "[COGNOME]::[NOME]::[REPARTO]::[TEL1]::[TEL2]::[TEL3]::[TEL4]::[REFERENTE]::[ID]" "backFromServer"

3 In parsedatarubrica you must put the name of the function to avoid a table init error: neoTableInitTable "Container1" "it-IT" 0 "Table" false true false false false "backFromServer"

4 You can simplify the Gestione contatti pushbutton action by avoiding a SQL query which is the same as the original one, and populating variables directly with [miobj]
SetVar [currentRecord] [selectedRow]-1

SetVar [ID] [miobj([currentRecord])('ID')]
SetVar [COGNOME] [miobj([currentRecord])('COGNOME')]
SetVar [NOME] [miobj([currentRecord])('NOME')]
SetVar [REPARTO] [miobj([currentRecord])('REPARTO')]
SetVar [TEL1] [miobj([currentRecord])('TEL1')]
SetVar [TEL2] [miobj([currentRecord])('TEL2')]
SetVar [TEL3] [miobj([currentRecord])('TEL3')]
SetVar [TEL4] [miobj([currentRecord])('TEL4')]
SetVar [REFERENTE] [miobj([currentRecord])('REFERENTE')]

5 finally, for pushbutton save you don't need to use the salvaRubrica function, since you reload loadRubrica afterwards.

luishp and Damasiciccio have reacted to this post.
luishpDamasiciccio

Thank you very much