update troubles again....

MichaelTJ

Member
Licensed User
Longtime User
SQL1.ExecNonQuery2("UPDATE DailyStats SET DteTme = ?, Carbs = ?, Protein = ?, Fat = ?, Cals = ?, Apidra = ?, Lantus = ?, BG = ?, BGtsts = ? WHERE ID = ?",Array As String(TotCarb, TotProt, TotFat, TotCals, TotApidra, TotLantus, AveBG, TotBGtsts, UrecID))

no error and no update.... i attempted this with and without various spacing alternatives as in the above and the below but neither alternative registers a syntax error and neither actually changes the data in the table

SQL1.ExecNonQuery2("UPDATE DailyStats SET DteTme=?, Carbs=?, Protein=?, Fat = ?, Cals=?, Apidra=?, Lantus=?, BG=?, BGtsts=? WHERE ID=?",Array Atring(TotCarb,TotProt,TotFat,TotCals,TotApidra,TotLantus,AveBG, TotBGtsts,UrecID))

UrecID is defined as int, the user record id DOES have the correct value when the update is attempted.... do i perhaps need to read the record IMMEDIATELY before attempting the update? i am baffled and have spent an entire day trying alternatives without success
 

MichaelTJ

Member
Licensed User
Longtime User
interesting....

incorrect number of supplied array items is not ALWAYS reported..... DteTme value was left out of the array for updating the record
 
Upvote 0

rboeck

Well-Known Member
Licensed User
Longtime User
Hi,

with SQLite you have to care for yourself, which data type in the data fields is used: if you store strings, than you have to look for strings in the update routine, if you stored integer, you have to supply an integer. Other databases change the datatype to the type, which is defined for the field. In sqlite alway that datatype is stored, which you supplied. I had a database, where i had 5000 integer values and 2000 string values in the same field. I had to write an update routine and than everything worked.
Greetings
Reinhard
 
Upvote 0
Top