B4J Question Connectionpool Mysql

jayel

Active Member
Licensed User
Longtime User
Hello,

I do this :
B4X:
Private Sub GetMachineDetails(s_machnr As String) As MachineDetail
    Dim query As StringBuilder
    Dim mymachinedetail As MachineDetail
    mymachinedetail.Initialize
    query.Initialize
   
    query.Append("SELECT * FROM tblmachine WHERE MachNr = ?")
    SQLMachines = MachinesConnectionPool.GetConnection
    
    s_machnr = s_machnr.SubString(1)
   
    Dim rs As ResultSet
   
    rs = SQLMachines.ExecQuery2(query,Array(s_machnr))
    Do While rs.NextRow
       
        mymachinedetail.id = 0'rs.GetInt("idNummer")
        mymachinedetail.munt = rs.GetDouble("Munt")
        mymachinedetail.naam = rs.GetString("MachNaam")
        mymachinedetail.nr = rs.GetInt("MachNr")
        mymachinedetail.aantal = 0
        mymachinedetail.bedrag = 0     
       
    Loop
    rs.Close
   
   
    Return mymachinedetail
    SQLMachines.Close
   
End Sub


It goes well, but suddenly I get this error :

Can somebody help me in the right direction to resolve this error?

Greets,

John
 

inakigarm

Well-Known Member
Licensed User
Longtime User
Try to close SQL connection before exit the Sub (
B4X:
 Return mymachinedetail
)

Possibly
B4X:
SQLMachines.close
isn't executed as you exit the sub before with Return
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…