[chargeable] MSMySQL - Yet another MySQL-Library (but a FAST one :-))

taufik adi sanjaya

Member
Licensed User
Longtime User
pn8qx.jpg



ERROR Result

2h2pg2g.jpg



I already do that's and the log result on attachment, how to show on listview2

Listview2 must be show with JDL_LAGU and PENYANYI also like Listview1
 
Last edited:

DonManfred

Expert
Licensed User
Longtime User
Use Query, not Query2. Query2 does not return a MAP.

Query2 returns a list of Strings holding all Values. You CANT access them using the fieldname. you can use the ORDER of the fields.
if JDL_LAGU is field 5 in the result you can get the 4th element from the list.
 

taufik adi sanjaya

Member
Licensed User
Longtime User
Hi Don,

So how to show two table on diferrent listview ?
listview1 show table datautm
listview2 show table pc4

if using Query only 1 table can retrive on listview1 right ??? and how about table pc4 to invoke on query ??
i was try but only 1 table show on listview1

B4X:
'=== QueryResult

Sub Activity_Create(FirstTime As Boolean)
   Dim t As String ="datautm"
   Dim tl As String ="pc4"
  
  
   Activity.LoadLayout("main")
   db.Initialize("MySQL",ipku,"dikha","dikha","database",True,True)
   db.QueryASync("select * from "&t&" LIMIT 0,100;",t)
  
   db.QueryASync("select * from "&tl&" LIMIT 0,100;",tl)
 
End Sub

Sub MySQL_QueryResult(data As List, meta As Map)
    Dim m As Map = meta

    listview1.Clear
    listview2.Clear

    For x=0 To data.Size-1
        If m.Get("TaskID") = "pc4" Then
            Dim cur As Map = data.Get(x)                
            listview2.AddTwoLines(cur.Get("JDL_LAGU"),cur.Get("PENYANYI"))
        End If
    Next

    For i=0 To data.Size-1
        If m.Get("TaskID") = "datautm" Then
            Dim cur As Map = data.Get(i)                
            listview1.AddTwoLines(cur.Get("JDL_LAGU")&" .::. "&cur.Get("PENYANYI"),cur.Get("SPATH"))
        End If
    Next    
End Sub
 
Last edited:

DonManfred

Expert
Licensed User
Longtime User
B4X:
Sub MySQL_QueryResult(data As List, meta As Map)
    If meta.Get("TaskID") = "datautm" Then
    ListView1.Clear
    For i=0 To data.Size-1
            Dim cur As Map = data.Get(i)               
      ListView1.AddTwoLines(cur.Get("JDL_LAGU")&" .::. "&cur.Get("PENYANYI"),cur.Get("SPATH"))
    Next   
  End If
  If meta.Get("TaskID") = "pc4" Then
      ListView2.Clear
    For x=0 To data.Size-1
        Dim cur As Map = data.Get(x)               
      ListView2.AddTwoLines(cur.Get("JDL_LAGU"),cur.Get("PENYANYI"))
    Next
    End If

End Sub
 

taufik adi sanjaya

Member
Licensed User
Longtime User
Hi Don,

Thank's for your fast respon. It's great Library and great support also :)

i already made two source with MSMySql and MySql Library, see attachment picture for compare

4zujqg.jpg



Source code with MSMySql and MySql will be send or your private


regards,
 

MohammadNew

Active Member
Licensed User
Longtime User
Hi Don, I use this code for connection but give me red line under it

db.Initialize("sql","host.com","dbuser","dbpassword","database")

when I put the mouse over the code then I see this

Missing Parameter

I alread fill my info.
 

MohammadNew

Active Member
Licensed User
Longtime User
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
Activity.LoadLayout("L1")

db.Initialize("MySQL","host.com","username","passowrd","databasename",True,True)

ListView1.Clear'need to clear the list
Dim t As String ="tpl1"
db.QueryASync("select * from "&t&" LIMIT 0,100;",t)

how to call this sub MySQL_QueryResult

End Sub

Sub MySQL_QueryResult(data As List, meta As Map)
Dim m As Map = meta

ListView1.Clear

For i=0 To data.Size-1
If m.Get("a1") = "tpl1" Then
Dim cur As Map = data.Get(i)
ListView1.AddTwoLines(cur.Get("a1")&" .::. "&cur.Get("a2"),cur.Get("a3"))
End If
Next
End Sub
 

taufik adi sanjaya

Member
Licensed User
Longtime User
where is to define table2 ?? and how to showing on listview2
Your source only table1 on listview1, but not show table2 on listview2 :)
 

taufik adi sanjaya

Member
Licensed User
Longtime User
Hi Mohammad, i hope you trying on two table...like master and detail
table1 as master show on listview1 and table2 as detail show on listview2 ( two table showing together )
Until now, i'm still confuse to solve this problem :(
 

DonManfred

Expert
Licensed User
Longtime User
Hi Mohammad, i hope you trying on two table...like master and detail
You need to build this master detail by yourself.

Do a query, in result sub you fill for example a listbox and store the id of the showed databasentry into the item
When you click on the item you get the stored id and fetches all detaildata from your database. In resultsub you show this in a second listview.

The point is that you need to build the logic by yourself.

The MySQL-Connector does nothing more than fetching data from the database based on your query.
 
Top