ExecuteRemoteQuery("INSERT INTO librocontabile (data,descrizione,cassabanca,entratauscita,categoria,euro) VALUES ('" & EditText7.text & "','" & EditText8.text & "', '" & scassaobanca & "', '" & entrata & "','" & Spinner3.GetItem & "', " & EditText9.text & ")", JobDone)
Cambia quel JobDone in "Speriamobene" o qualunque altra stringa tra virgolette visto che ExecuteRemoteQuery si aspetta un parametro stringa.
Poi nella sub JobDone dovresti avere un test se il job è proprio "Speriamobene" visto che la stessa sub è il punto di arrivo di ogni "Dim job As HttpJob" che potresti avere nel modulo.
udg
dim query as string =$"SELECT * FROM ${mytable}
WHERE id=${userid}
LIMIT 1;"$
Ammesso che il resto della query sia scritto correttamente, devi sostituire inserisci con "inserisci". Sempre che ExecuteRemoteQuery si aspetti due parametri, entrambi di tipo stringa come si vede nel post #24EditText9.text & ")", inserisci)
In JobDone, anche questo inserisci va tra virgolette.Case inserisci
B4A version: 6.50
Parsing code. Error
Error parsing program.
Error description: Syntax error.
Occurred on line: 195 (Main)
ExecuteRemoteQuery("INSERT INTO librocontabile (data,descrizione,cassabanca,entratauscita,categoria,euro) VALUES ('" & EditText7.text & "','" & EditText8.text & "', '" & scassaobanca & "', '" & entrata & "','" & Spinner3.GetItem & "', " & EditText9.text & "), "inserisci")
Prova conSpinner3.GetItem & "', " & EditText9.text & ")
dim query as string
query=$"INSERT INTO librocontabile (data,descrizione,cassabanca,entratauscita,categoria,euro)
VALUES ('${EditText7.text}', '${EditText8.text}', '${scassaobanca }', '${entrata}' , '${Spinner3.GetItem }', '${EditText9.text}');"$
log(query)
ExecuteRemoteQuery(query,"inserisci")
Dim scassaobanca As String
Dim query As String
If RadioButton1.Checked = True Then
scassaobanca = "cassa"
Else
scassaobanca ="banca"
End If
entrata =""
entrata = "entrata"
query=$"INSERT INTO librocontabile (data,descrizione,cassabanca,entratauscita,categoria,euro) VALUES ('${EditText7.text}','${EditText8.text}','${scassaobanca }','${entrata}','${Spinner3.GetItem }','${EditText9.text}');"$ "inserisci")
Log(query)
ExecuteRemoteQuery(query,"inserisci")
B4A version: 6.50
Parsing code. Error
Error parsing program.
Error description: Invalid number of parentheses.
Occurred on line: 195 (Main)
query=$"INSERT INTO librocontabile (data,descrizione,cassabanca,entratauscita,categoria,euro) VALUES ('${EditText7.text}','${EditText8.text}','${scassaobanca}','${entrata}','${Spinner3.GetItem}','${EditText9.text}');"$ inserisci)
#Region Module Attributes
#FullScreen: true
#IncludeTitle: True
#ApplicationLabel:formesempio
#VersionCode: 1
#VersionName: 1.0
#SupportedOrientations: portrait
#End Region
'Activity module
Sub Process_Globals
Private entrate = "entrate", uscite = "uscite" As String, inserisci = "inserisci" As String
'Private entrate = "entrate", uscite = "uscite" As String,
End Sub
Sub Globals
Type TwoLines (First As String, Second As String)
Dim lblPopulation As Label
Dim ListView1 As ListView
Dim ListView2 As ListView
Dim lblCountry As Label
Private panel1 As Panel
Private panel11 As Panel
Private panel3 As Panel
Private panel9 As Panel
Private Spinner1 As Spinner
Private Spinner3 As Spinner
Private EditText7 As EditText
Private EditText9 As EditText
Private EditText8 As EditText
Private EditText1 As EditText
Private EditText2 As EditText
Private EditText3 As EditText
Private RadioButton1 As RadioButton
Private RadioButton2 As RadioButton
Private RadioButton3 As RadioButton
Private RadioButton4 As RadioButton
Dim entrata As String
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("1")
'DateTime.DateFormat="dd/MM/yyyy"
'DateTime.TimeFormat="HH:mm"
panel1.SetLayout(0,0,100%x,100%y)
panel11.SetLayout(0,0,100%x,100%y)
panel9.SetLayout(0,0,100%x,100%y)
panel3.SetLayout(0,0,100%x,100%y)
panel9.Visible=True
panel11.Visible=False
panel3.visible=False
panel1.Visible= False
panel11.visible = False
Spinner1.AddAll(Array As String("Quota associativa", "Erogazioni", "Raccolta Fondi", "Contributi", "Interessi attivi"))
Spinner3.AddAll(Array As String("Cancelleria", "Utenze", "Postali", "Spese Bancarie", "Attrezzatura", "Compensi", "Pulizia", "Assicurazioni", "Altre spese"))
End Sub
Sub ExecuteRemoteQuery(Query As String, JobName As String)
Dim job As HttpJob
job.Initialize(JobName, Me)
job.PostString("https://www.xxxx.com/xxxxx/xxxx.php", Query)
End Sub
Sub JobDone(Job As HttpJob)
ProgressDialogHide
If Job.Success Then
Dim res As String
res = Job.GetString
Log("Response from server: " & res)
Dim parser As JSONParser
parser.Initialize(res)
Select Job.JobName
Case entrate
Dim COUNTRIES As List
COUNTRIES = parser.NextArray
For i = 0 To COUNTRIES.Size - 1
Dim m As Map
m = COUNTRIES.Get(i)
Dim tl As TwoLines
tl.First = m.Get("data")
tl.Second = m.Get("euro")
ListView1.AddTwoLines2(tl.First, tl.Second, tl)
Next
Case uscite
Dim COUNTRIES As List
COUNTRIES = parser.NextArray
For i = 0 To COUNTRIES.Size - 1
Dim m As Map
m = COUNTRIES.Get(i)
Dim tl As TwoLines
tl.First = m.Get("data")
tl.Second = m.Get("euro")
ListView2.AddTwoLines2(tl.First, tl.Second, tl)
Next
Case "inserisci"
End Select
Else
Log(Job.ErrorMessage)
ToastMessageShow("Error: " & Job.ErrorMessage, True)
End If
Job.Release
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub FetchentrateList
ProgressDialogShow("Fetching list of anomalie")
Dim sentrata As String
sentrata = " & entrata &"
'Gets all the available countries
ExecuteRemoteQuery("SELECT * FROM librocontabile WHERE entratauscita ='" & sentrata & "' ORDER BY data ", entrate)
End Sub
Sub FetchusciteList
'Gets all the available countries
Dim suscita As String
suscita = " & uscita &"
ExecuteRemoteQuery("SELECT * FROM librocontabile WHERE entratauscita ='" & suscita & "' ORDER BY data ", uscite)
End Sub
Sub cmd_torna_Click
panel1.Visible=True
End Sub
Sub Torna_Click
End Sub
Sub cmd_stat_Click
panel1.Visible= False
End Sub
Sub cmd_indietro_Click
panel1.Visible= False
End Sub
Sub cmd_anomalia_Click
panel1.Visible=False
End Sub
Sub TIPO_Click
panel1.Visible=False
End Sub
Sub cmd_tornatipologia_Click
panel1.Visible= False
panel9.Visible= True
End Sub
Sub cmd_tornascheda_Click
panel1.Visible= False
End Sub
Sub cmd_tornaambito_Click
panel1.Visible= False
End Sub
Sub Fetchinserimento
Dim scassaobanca As String
Dim query As String
If RadioButton1.Checked = True Then
scassaobanca = "cassa"
Else
scassaobanca ="banca"
End If
entrata =""
entrata = "entrata"
query=$"INSERT INTO librocontabile (data,descrizione,cassabanca,entratauscita,categoria,euro) VALUES ('${EditText7.text}','${EditText8.text}','${scassaobanca}','${entrata}','${Spinner3.GetItem}','${EditText9.text}');"$ inserisci)
Log(query)
ExecuteRemoteQuery(query,"inserisci")
End Sub
Sub cmd_incassomese_Click
panel1.Visible= False
End Sub
Sub cmd_tornapanel8_Click
panel1.Visible= False
End Sub
Sub Button1_Click
panel11.Visible=True
panel9.visible=False
panel1.Visible=False
panel3.Visible=False
EditText7.text = ""
EditText9.text =""
EditText8.text =""
End Sub
Sub lbl_tipopark_Click
End Sub
Sub Button2_LongClick
panel11.Visible=False
panel9.visible=False
panel3.visible=False
panel1.Visible=True
FetchusciteList
FetchentrateList
End Sub
Sub Button2_Click
panel11.Visible=False
panel9.visible=False
panel3.visible=False
panel1.Visible=True
End Sub
Sub Button5_Click
panel1.Visible=False
panel1.Visible= False
panel9.Visible= True
End Sub
Sub cmd_tornacerca_Click
panel1.Visible=False
panel1.Visible= False
panel9.Visible= True
End Sub
Sub txt_cerca_TextChanged (Old As String, New As String)
End Sub
Sub Button3_Click
panel3.visible=True
panel11.Visible=False
panel9.visible=False
panel1.Visible= False
EditText1.Text = ""
EditText3.Text =""
EditText2.Text =""
End Sub
Sub Button7_LongClick
End Sub
Sub Button7_Click
panel11.Visible=False
panel9.visible=True
panel3.visible=False
panel1.Visible= False
End Sub
Sub Button8_Click
panel11.Visible=False
panel9.visible=True
panel3.visible=False
panel1.Visible= False
End Sub
Sub Button9_Click
panel11.Visible=False
panel9.visible=True
panel3.visible=False
panel1.Visible= False
End Sub
Sub Button11_Click
Fetchinserimento
End Sub
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?