Ok,
I have a strange problem and am trying to narrow it down.
In my OS X app I have 2 properties in a module:
IncidentsRS (type recordset)
IncidentsDB (type SQLiteDatabase)
I have the following code which SHOULD return the database values for the selected listbox row in the main window, and then populate text fields in the edit window with those values:
[code]// DEFINE THE DATABASE PATH
Dim fi As FolderItem = SpecialFolder.ApplicationData.Child(“Incidents Data”).Child(“Incidents.db”)
IncidentsDB = new SQLiteDatabase
IncidentsDB.DatabaseFile = fi
// CHECK DATABASE CONNECTION
If IncidentsDB.Connect = True Then
// RETRIEVE VALUES FROM THE SELECTED LISTBOX ROW IN THE MAIN WINDOW
Dim IRNumber as String = MainWindow.IncidentsListBox.cell(MainWindow.IncidentsListBox.listindex,0)
IncidentsRS = IncidentsDB.SQLSelect(“SELECT IRef, Number, Type, Date, Involved, Dealing FROM Incidents WHERE IRef=’”+IRNumber+"’")
// NO RECORDSET FOUND, SO DISPLAY THE ERROR MSGBOX
if IncidentsRS = nil then
msgbox(“No record found.”)
// RECORDSET FOUND, SO POPULATE ALL FIELDS IN THE EDIT WINDOW WITH THE APPROPRIATE ENTRIES
else
Win_Edit.NumberTextField.text = IncidentsRS.field(“Number”).StringValue
Win_Edit.TypeTextField.text = IncidentsRS.field(“Type”).StringValue
Win_Edit.DateTextField.text = IncidentsRS.field(“Date”).StringValue
Win_Edit.InvolvedTextField.text = IncidentsRS.field(“Involved”).StringValue
Win_Edit.DealingTextField.text = IncidentsRS.field(“Dealing”).StringValue[/code]
Does anyone have any ideas why the recordset vales returned seem to be blank?
I even tried a msgbox as below, but that displayed an empty msgbox:
MsgBox(IncidentsRS.field("Number").StringValue)
Could it be something to do with this segment - IRef is an INTEGER PRIMARY KKEY:
// RETRIEVE VALUES FROM THE SELECTED LISTBOX ROW IN THE MAIN WINDOW
Dim IRNumber as String = MainWindow.IncidentsListBox.cell(MainWindow.IncidentsListBox.listindex,0)
IncidentsRS = IncidentsDB.SQLSelect("SELECT IRef, Number, Type, Date, Involved, Dealing FROM Incidents WHERE IRef='"+IRNumber+"'")
Thank you all in advance.