I thought I was there, but now I think that what I was looking for does not exist
B4X:
'This does not work!!
Sub fillpagefromdbDim Cursor1 As Cursor,name As String,value As String,o As View
Cursor1 = db.sql1.ExecQuery("SELECT * FROM table1")
For i = 0To Cursor1.RowCount - 1
Cursor1.Position = i
name=Cursor1.GetString("name")
value=Cursor1.GetString("data")
o=GetObjectFromTag(name)
If (o) Then o.text=value
Next
Cursor1.Close
EndSubSub GetObjectFromTag(a As String) As ViewDim o As View
o=NullFor i = 0To Activity.NumberOfViews - 1If Activity.GetView(i).Tag = a Then
o=Activity.GetView(i)
ContinueEndIfNextReturn o
EndSub
What does not work ?
This line looks strange to me :
B4X:
If (o) Then o.text=value
Perhaps I'm wrong, never tried this.
But without knowing what is not working I don't want to spend much time to guess what could be wrong.
Don't you have a small test project to test it ?
This obviously does work, but somehow I find it less appealing
B4X:
Sub fillPageFromDbDim Cursor1 As Cursor,name As String,data As String
Cursor1 = db.sql1.ExecQuery("SELECT * FROM table1")
For i = 0To Cursor1.RowCount - 1
Cursor1.Position = i
name=Cursor1.GetString("name")
data=Cursor1.GetString("data")
Select name
Case"label1"
Label1.Text=data
Case"titel"
Label2.text=data
EndSelectNext
Cursor1.Close
EndSub
I think the map in Erel's solution needs to be maintained manually, ie. there is no way to generate that map?!
What does not work ?
This line looks strange to me :
B4X:
If (o) Then o.text=value
Perhaps I'm wrong, never tried this.
But without knowing what is not working I don't want to spend much time to guess what could be wrong.
Don't you have a small test project to test it ?...
All this looks quite complicated to me.
What kind of data do you have in your database?
When I use a database I know what data is in there and design the interface according to tha data.
But it seems I am missing something here.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.