I would like to generate a row of numbers and store them into SQLite
in each line.
Does anyone know why this is NOT going with this code:
B4X:
Cursor = SQL1.ExecQuery("SELECT Feld_006 FROM Abrechnung")
For i = 0 To Cursor.RowCount -1
Cursor.Position = i
Dim Abrechnung_IDNR As String
Abrechnung_IDNR = i +1 '-- Position of Cursor +1 --
'-- Save to SQLite --
SQL1.ExecNonQuery("UPDATE Abrechnung SET Feld_006 = '"&Abrechnung_IDNR&"' ") 'WHERE Feld_006 = '"&Cursor.Position&"' +1 ")
Log("-- 3196 -- Abrechnung-IDNR: "&Abrechnung_IDNR&"")
Next
Cursor.Close
In the log file the count are displayed , but in SQLite only the " last " IDNR is stored the same in all the rows .
Although @JOTHA has already solved his problem and no longer pursuing this thread, I would like to pursue it out of curiosity. Why both of your solution codes have to be so complicated.
Here is my solution. Even if rows were deleted later, the numbers will still be unique and ascending:
B4X:
SQL1.ExecNonQuery("update Abrechnung SET Feld_006= rowid")
Although @JOTHA has already solved his problem and no longer pursuing this thread, I would like to pursue it out of curiosity. Why both of your solution codes have to be so complicated.
Here is my solution. Even if rows were deleted later, the numbers will still be unique and ascending:
B4X:
SQL1.ExecNonQuery("update Abrechnung SET Feld_006= rowid")
Apparently the exact renumbering was not that important to the guy who posted the thread, as long as they are unique and ascending, if you check one of his posts.
Apparently the exact renumbering was not that important to the guy who posted the thread, as long as they are unique and ascending, if you check one of his posts.