DBUtils is very useful.
However try something like this (some of this was taken from a help guide posted somewhere on these forums)
Note that DBFileDir, DBFileName have been set in my process_globals, like this :-
Dim DBFileName As String : DBFileName = "rdb.sql"
Dim DBTableName As String : DBTableName = "Rec"
Dim DBFileDir As String : DBFileDir = File.DirInternal
Create two subs (ListViewInit & ListViewFill)
And in Activity_Create, loadlayout, initialize SQL1 and then underneath put ListViewInit and ListViewFill (example below)
Then in your Init sub, create the listview (i.e your single line layout color and so on), then in your ListViewFill query your DB and send the string to the ListView.
Example :-
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Indian")
SQL1.Initialize(DBFileDir, DBFileName, True)
ListViewInit
ListViewFill
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub ListViewInit
rlv.TwoLinesLayout.Label.Left = 0
rlv.TwoLinesLayout.Label.Width = 100%x
rlv.SingleLineLayout.Label.Color = Colors.White
rlv.SingleLineLayout.Label.TextColor = Colors.Black
End Sub
Sub ListViewFill
Dim txt As String
Dim cur As Cursor
txt = "SELECT Name FROM Rec WHERE Nationality ='Indiann" & currname & "'"
rlv.Clear
cur = SQL1.ExecQuery(txt)
For i = 0 To cur.RowCount -1
cur.Position = i
rlv.AddSingleLine(cur.GetString("Name"))
Next
End Sub