Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim sql1 As SQL
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
'Activity.LoadLayout("Layout1")
If FirstTime Then
sql1.Initialize(File.DirDefaultExternal, DateTime.GetMonth(DateTime.Now) &"."& DateTime.GetDayOfMonth(DateTime.Now) &"."& DateTime.GetYear(DateTime.Now) & " " & DateTime.TIME(DateTime.Now) & ".db", True)
End If
createtables
End Sub
Sub populatedatabased
sql1.BeginTransaction
Try
sql1.ExecNonQuery("INSERT INTO table1 VALUES ('"+playeronename+"', "+EBmakep1+", "+EBMissp1+", "+EBdefp1+", "+EBLotp1+", "+EBMobP1+", "+EBDeadp1+", "+EBe8P1+", "+EB8obp1+", "+EBbnrp1+", '"+winnerwinner+"', "+gamechosen+")")
sql1.ExecNonQuery("INSERT INTO table1 VALUES ("+playertwoname+", "+EBmakep2+", "+EBMissp2+", "+EBdefp2+", "+EBLotp2+", "+EBMobP2+", "+EBDeadp2+", "+EBe8P2+", "+EB8obp2+", "+EBbnrp2+", "+winnerwinner+", "+gamechosen+")")
sql1.ExecNonQuery("INSERT INTO table1 VALUES ('george', "+EBmakep1+", 4, 2, 0, 1, 6, 0, 0, 1, 'george', 8)")
sql1.ExecNonQuery("INSERT INTO table1 VALUES ('TED', 22, 41, 21, 01, 11, 61, 01, 01, 11, 'george', 8)")
sql1.TransactionSuccessful
Catch
Log(LastException.Message)
End Try
sql1.EndTransaction
End Sub
Sub createtables
sql1.ExecNonQuery("DROP TABLE IF EXISTS table1")
sql1.ExecNonQuery("CREATE TABLE table1 (Col1 TEXT, col2 INTEGER, col3 INTEGER, col4 INTEGER, col5 INTEGER, col6 INTEGER, col7 INTEGER, col8 INTEGER, col9 INTEGER, col10 INTEGER, col11 TEXT, col12 INTEGER)")
End Sub