Android Question Requesting support for DBUTILS , JSON & List

Noorul HAQUE

Member
Licensed User
Hi All

I am new to B4A, It will be highly appreciated if some one could support me for below case

I have SQLite database which is having below fields.

LMsgID(int) , LMessage (String) , lMsgHead (string) , lmsgType (string).

I am using DBUTILS to get records from this database.

Dim gen As JSONGenerator
gen=(DBUtils.Executejson(SQL1,"SELECT LmsgID, Lmessage, LmsgHead, lMsgtype from Messages",Null,0,Array As String(DBUtils.DB_INTEGER,DBUtils.DB_TEXT, DBUtils.DB_TEXT, DBUtils.DB_INTEGER)))

Dim JSONString As String
JSONString = gen.ToPrettyString(4)

I have type and list defined as below

Type Messages2Display(msgId As Int, msgHead As String, MsgDescription As String, msgType As Int)

Dim Messages2fill As List
Messages2fill.Initialize

I need to fill this LIST from records or any other ways to fill my LIST.

With Regards
 

Noorul HAQUE

Member
Licensed User
Ok I got it.....

Dim Table As List
Dim Messages2fill As List
Messages2fill.Initialize
Table =DBUtils.ExecuteMemoryTable(SQL1, "Select LmsgID, Lmessage, LmsgHead, lMsgtype from Messages" , Null,0)
Dim Cols() As String
For i = 0 To Table.Size - 1
Dim p As Messages2Display
Cols = Table.Get(I)
p.msgId=Cols(0)
p.MsgDescription=Cols(1)
p.msgHead=Cols(2)
p.msgType=Cols(3)
Messages2fill.Add(p)
Next
 
Upvote 0
Top