Hi all,
Really new to XOJO, SQL and Database
I have created 2 methods
One to save to my DB (RouterInfo) and one to edit:
Save Method:
Dim SaveRouterInfoToDB as new DatabaseRecord // Creating Variable name
SaveRouterInfoToDB.Column("DeviceName") = Trim(DeviceNameBox.Text) // Colounm in Database
SaveRouterInfoToDB.Column("MAC") = Trim(MACAddressBox.Text) // Colounm in Database
RouterDB.InsertRecord "Devices", SaveRouterInfoToDB //Sending Data to the Table in MainDB
RouterDB.Commit
Edit Method:
[code] Dim DBRecordEditCall as new DatabaseRecord // This is calling the Databse
Dim sql as String // This is setting the SQL Code Needed to bring back data from the saved table
// The SQL CODE is trying to match row in Database with the infomaiton taken from the RouterListbox
sql = "select DeviceName,MAC,RouterUp,RouterDown,DateAdded from Devices where name = " + RouterListBox.Cell(RouterListBox.ListIndex,0) + " and MAC = " + RouterListBox.Cell(RouterListBox.ListIndex,1)
Dim DatabaseEditSet as RecordSet = RouterDB.SQLSelect(sql) // Passing the SQL query on the Main Database
DatabaseEditSet.Edit // Setting the start to EDIT the DATABASE
DatabaseEditSet.Field(“DeviceName”).StringValue = trim(DeviceNameBox.Text) // DeviceName
DatabaseEditSet.Field(“MAC”).StringValue = trim(MACAddressBox.Text) // MAC
DatabaseEditSet.Update // Telling the DB That The Above Info is needed to be updated on select item
RouterDB.Commit // Database SAVES changes
DatabaseEditSet.Close
[/code]
When ever i then action this method my app fails and throws a NilObjectException on
DatabaseEditSet.Edit // Setting the start to EDIT the DATABASE
Can anyone see what i’m doing wrong?
Any help is greatly appreciated