Android Question SQLiteLight3_B4XTABLE

rodmcm

Active Member
Licensed User
Sitting isolated at home decided to learn about SQL light

In the above example when it opens I get the three database field columns on a tablet in landscape mode as expected

If I <edit> and <update> I then get 6 columns, the last three with the same headers and 'null' as entry

If I do it again I get 9 columns etc etc etc.

How is this happening? I cannot for the life of me see it in code
 

mangojack

Expert
Licensed User
Longtime User
I cannot for the life of me see it in code



Neither can we ... ;) Seriously , Some posted code or a small example project would help.
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
I suppose that you found this project in the source code folder of the B4X SQLite database booklet.
Unfortunately, when I posted the last update I forgot to remove this project and the chapter, it was still in work.
Sorry for the trouble.
Currently, I am writing a new booklet B4X Cross-platform projects and there will be a new version of this project.
 
Upvote 0

rodmcm

Active Member
Licensed User
Hi Klaus
Found it for your future reference!

When you return from editing the Activity Resume function calls "ShowTable". which calls FillTable(Query).
This as the code which adds the extra columns on each return

B4X:
    For i = 0 To Starter.ColNumber - 1
        xtblTable.AddColumn(Starter.ColAliasNames(i), xtblTable.COLUMN_TYPE_TEXT)
    Next


The way I got out of it was to remove above and have a CreateTable sub that is only called on Activity Create
B4X:
ub CreateTable
    Log("CreateTable")
    xtblTable.HeaderColor=Colors.RGB(32,179,220)
    xtblTable.HeaderTextColor=Colors.Blue
    xtblTable.EvenRowColor=Colors.LightGray
    For i = 0 To Starter.ColNumber - 1
        xtblTable.AddColumn(Starter.ColAliasNames(i), xtblTable.COLUMN_TYPE_TEXT)
    Next
    lblSelectedItem.Text=""
    Sleep(0)
    xtblTable.SearchField.mBase.Visible=False
End Sub
 
Upvote 0
Top