Android Question Help to use Dbutils.RecordUpdate

hibrid0

Active Member
Licensed User
Longtime User
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.
 
Last edited:

hibrid0

Active Member
Licensed User
Longtime User
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.
 
Last edited:
Upvote 0

hibrid0

Active Member
Licensed User
Longtime User
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.
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
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 ?
 
Upvote 0

hibrid0

Active Member
Licensed User
Longtime User
Hi Klaus I use all columns, Every colums have the questions and the next answers.
I accept suggetions. In one moment I create a db and upload it.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…