Hi
when i run thd1.Start, B4j always give me a error from Thd1_Ended. the error is Exception:null.
I cann't run ExecSql, Why ????
when i run thd1.Start, B4j always give me a error from Thd1_Ended. the error is Exception:null.
I cann't run ExecSql, Why ????
B4X:
Private thd1 As Thread
thd1.Initialise("thd1")
thd1.Start(Me,"ExecSql",Array As String("Record",s1))
Sub ExecSql(flow As String,sqls As String)
If (sqls="") Then Return
Dim sq As SQL' = DB.pool.GetConnection 'get a DB connection (change DB to Main)
sq.InitializeSQLite(File.DirApp, "gsmgateway.db3", False)
'sq.Initialize2("com.mysql.jdbc.Driver", "jdbc:mysql://" & db_host & "/data1?characterEncoding=utf8",db_account,db_passwd)
sq.BeginTransaction
Try
sq.ExecNonQuery(sqls)
sq.TransactionSuccessful
Log(flow)
Catch
If LastException.IsInitialized Then
Log(flow & " Exp:"&LastException.Message)
Else
Log(flow & " Exp:Error")
End If
End Try
End Sub
Sub Thd1_Ended(endedOK As Boolean, error As String) 'The thread has terminated. If endedOK is False error holds the reason for failure
If endedOK Then
Log("thd1 OK")
Else
Log("thd1 NG:"&error)
End If
End Sub