I am trying to compile this code and it is giving me an error. I adjusted the code from the DBUtils program but I obviously am not doing it correctly and I can't see where it is not correct.
Here is the code. I put it into the activity_create sub and all I want it to do is populate editboxes with the only field in the table when the activity loads.
And here is the error I get. I know that in the DBUtils program, the declaration of the value is stated in the sub for the spinner (which is: Sub spnrStudentId_ItemClick (Position As Int, Value As Object) but when I try that, the app compiles but when I start that activity on the phone, it gives me an error stating that the signature received was not what was expected or something like that.
Here is the code. I put it into the activity_create sub and all I want it to do is populate editboxes with the only field in the table when the activity loads.
B4X:
Dim m As Map
m = DBUtils.ExecuteMap(SQL1, "SELECT companynumber, companyname, companystreet, companycity, companystate, companyzip, companyphone1, companyphone2 FROM company WHERE companynumber = ?", Array As String(value))
If m.IsInitialized = False Then
Msgbox("No information found.","")
Else
txtNumber.Text = m.Get("companynumber")
txtName.Text = m.Get("companyname")
txtAddress.Text = m.Get("companystreet")
txtCity.Text = m.Get("companycity")
txtState.Text = m.Get("companystate")
txtZip.Text = m.Get("companyzip")
txtPhone1.Text = m.Get("companyphone1")
txtPhone2.Text = m.Get("companyphone2")'keys are lower cased!
End If
And here is the error I get. I know that in the DBUtils program, the declaration of the value is stated in the sub for the spinner (which is: Sub spnrStudentId_ItemClick (Position As Int, Value As Object) but when I try that, the app compiles but when I start that activity on the phone, it gives me an error stating that the signature received was not what was expected or something like that.
B4X:
Compiling code. Error
Error parsing program.
Error description: Undeclared variable 'value' is used before it was assigned any value.
Occurred on line: 35
m = DBUtils.ExecuteMap(SQL1, "SELECT companynumber, companyname, companystreet, companycity, companystate, companyzip, companyphone1, companyphone2 FROM company WHERE companynumber = ?", Array As String(value))