I'm starting to use the RDC to connect to my mysql database on my server.
I changed the various connection parameters to fit both my server and the content of my database and everything works perfectly.
The problem that feedback and that I can not run two queries simultaneously. I try to explain.
I have to fill a spinner with the contents of a table (regions) and stop the program if the spinner displays correctly with fields we picked up from the table, but if after the execution of the first spinner, I run a second query, with selected cmbRegioni .selectedItem the query returns an error of OutOfBoundMemory because the spinner is still empty and therefore can not find the index 0. I approached recently to Basic4 and assume that the function jobdone, is performed in the background so that ground when sending the second query execution in the data are not yet available to be manipulated.
I enclose only a part of the code to figure out where I run the two requests and how I can control when the function jobdone has completed its cycle and make a second request.
thanks
google translation ..... sorry
I changed the various connection parameters to fit both my server and the content of my database and everything works perfectly.
The problem that feedback and that I can not run two queries simultaneously. I try to explain.
I have to fill a spinner with the contents of a table (regions) and stop the program if the spinner displays correctly with fields we picked up from the table, but if after the execution of the first spinner, I run a second query, with selected cmbRegioni .selectedItem the query returns an error of OutOfBoundMemory because the spinner is still empty and therefore can not find the index 0. I approached recently to Basic4 and assume that the function jobdone, is performed in the background so that ground when sending the second query execution in the data are not yet available to be manipulated.
I enclose only a part of the code to figure out where I run the two requests and how I can control when the function jobdone has completed its cycle and make a second request.
thanks
google translation ..... sorry
B4X:
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim Scroll As ScrollView
Dim CmbRegione As Spinner
Dim Cmbprovince As Spinner
Dim cd As ColorDrawable
Dim PanelHeight As Int : PanelHeight=80dip
Dim REGIONE ="Regione", PROVINCIA ="Province", PNL ="Panel", COUNT="Conteggio" As String
Dim prov(20) As String
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")
Activity.LoadLayout ("frmricercaview")
Scroll.Initialize (100%x)
Activity.AddView (Scroll, 0, 40dip, 100%x, 100%y)
Scroll.Color =Colors.Black
CmbRegione.Left =Activity.Width /2 - CmbRegione.Width /2
CmbRegione.Prompt ="Regione"
FetchCountriesRegione
CmbRegione.SelectedIndex =0
FetchProvince
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub FetchCountriesRegione
'Utilizzato per riempire ilcombox delle regioni
ProgressDialogShow("Sto caricando le informazioni")
'Gets all the available countries
ExecuteRemoteQuery("SELECT Regione FROM regioni ORDER BY Regione", REGIONE)
End Sub
Sub FetchProvince
'Utilizzato per riempire la variabile delle province secondo la regione selezionata
ProgressDialogShow("Sto caricando le informazioni")
'Gets all the available countries
ExecuteRemoteQuery("SELECT Provincia FROM province WHERE Regione ='" & CmbRegione.SelectedItem &"' ORDER BY Provincia", PROVINCIA)
'Here goes wrong because cmbregione not initialized
End Sub