B4J Question Server -

BeneBarros

Active Member
Licensed User
Longtime User
Use global variables can cause problems?
Example:
B4X:
'Handler class
Sub Class_Globals
    Private BB_Conn As SQL
    Private Rs As ResultSet 
    Private sXml As String
    Private cXml As ClsXml           
End Sub

Public Sub Initialize
    BB_Conn.Initialize("net.sourceforge.jtds.jdbc.Driver","jdbc:jtds:sqlserver://" & Utils.IpSql & ":1433/MyDb;user=" & Utils.UserBB & ";password=" & Utils.PwdBB )
    DateTime.DateFormat = "dd/MM/yyyy"
    cXml.Initialize("RETORNO")       
End Sub

Sub Handle(Req As ServletRequest, Resp As ServletResponse)
    If Req.Method <> "POST" Then
 . . .
 

Daestrum

Expert
Licensed User
Longtime User
Although I can't work out the problem with the code you posted, I would guess its probably the Private keyword stopping other modules getting access to the BB_Conn variable.
 
Upvote 0
Top