Hi, I try to update the record "2" of a table callled "test" with the UpdateRecord and UpdatedRecord2,
I can add new records with
DBUtils.InsertMaps(SQL1, "test", ListOfMaps) and this Add a new record.
I try to update record with:
B4X:
Mapa_Datos.Put("id", "2")
For i = 0 To 150 -1
If i <= 150 Then
Mapa_Datos.Put((Num_campo&Num_campo2), edt_R(i).text)
fields_list.Put((Num_campo&Num_campo2), edt_R(i).text)
Num_campo2=Num_campo2+1
Log(edt_R(i).Text)
End If
Next
ListOfMaps.Add(Mapa_Datos)
listofFields.add(fields_list)
DBUtils.UpdateRecord2(SQL1, "test", ListOfFields, ListOfMaps)
I'm using it wrong, but I dont understand what is wrong.
Because I don't know how do that!. I make that "for" to get 151 fields from the 1 record.
And I see that cost a lot of power performance(152 queries..).
I have a database with 152 fields, and I need to get the 151 fields in an array.
Then I read the 152 fields from the record1, next I get the record2...
My experience with databases is very limited, and maybe I'm using it wrong.
In the table I save 152 questions and the next record are the answers.
I accept suggestions if I'm making it wrong.
And I'm using a similar code to put info in the db.
Sorry, but I don't understand your database structure. I'm not sure that your structure is the best one.
What columns do you have in the table ?
Can you explain it more in detail.
Hi Klaus at the moment I have 152 Columns, then in the record 1 (id=1) they are questions I need to show to the user.
And on the record 2, 3, 4, 5, 6, 7, 8.. I save the answers.
And with the info from record id=2 I generate a PDF.
Do I understand well ? You use 151 columns in record 1, but you use only 1 column with the answer in the next records ?
Why don't you use two columns one with the questions and the second one with the answers.
Each record has a question with its answer.
Or am I missing something ?