B4J Question Using dbutils

kelvo01

Member
Licensed User
Longtime User
How to execute a query. obtain some rows of results and parse field results?

...
ExecuteMemoryTable( selet *fom

Do While NOT EOF ...
Loop

the exact code ? an example ?
 

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

kelvo01

Member
Licensed User
Longtime User
A mean a short way to make this with dbutils 2


B4X:
cerca="SELECT MVNUMDOC, MVALFDOC, MVDATDOC, MVTIPDOC, MVCODMAG, CLCODCLI, CLRAGSOC, MVTOTDOC "
    cerca=cerca&" FROM MOVIME LEFT JOIN CLIFOR ON MVCOD_CF = CLCODCLI "
    cerca=cerca&" WHERE MVTIPDOC='DT' AND MVTPCLFO='1' AND MV__ANNO='2019' "
    cerca=cerca&" ORDER BY MVALFDOC, MVNUMDOC "'limit 100 "
    
    Dim rs As ResultSet

    rs = gSQL.ExecQuery(cerca)
    Do While rs.NextRow
        Log(rs.GetString("MVALFDOC"))
    Loop
    rs.Close
 
Upvote 0

universengo

Member
A mean a short way to make this with dbutils 2


B4X:
cerca="SELECT MVNUMDOC, MVALFDOC, MVDATDOC, MVTIPDOC, MVCODMAG, CLCODCLI, CLRAGSOC, MVTOTDOC "
    cerca=cerca&" FROM MOVIME LEFT JOIN CLIFOR ON MVCOD_CF = CLCODCLI "
    cerca=cerca&" WHERE MVTIPDOC='DT' AND MVTPCLFO='1' AND MV__ANNO='2019' "
    cerca=cerca&" ORDER BY MVALFDOC, MVNUMDOC "'limit 100 "
   
    Dim rs As ResultSet

    rs = gSQL.ExecQuery(cerca)
    Do While rs.NextRow
        Log(rs.GetString("MVALFDOC"))
    Loop
    rs.Close
You can replace the "cerca=cerca&" by using "& _" as below
B4X:
cerca="SELECT MVNUMDOC, MVALFDOC, MVDATDOC, MVTIPDOC, MVCODMAG, CLCODCLI, CLRAGSOC, MVTOTDOC " & _
   " FROM MOVIME LEFT JOIN CLIFOR ON MVCOD_CF = CLCODCLI " & _
   " WHERE MVTIPDOC='DT' AND MVTPCLFO='1' AND MV__ANNO='2019' " & _
   " ORDER BY MVALFDOC, MVNUMDOC "'limit 100 "
 
Upvote 0
Top