Database application MSSQL Server CRUD operations

Hi,

I am building a web application connected to a MS SQL Server database.
I’d like to perform typical CRUD operations but wanted to check a few things to ensure it follows best practice in Xojo.

To write data into a WebListBox:

  • Perform an SQL query on the database
  • Iterate the returning RowSet and populate the WebListBox.

To map data from selected row in WebListBox to fields in form:

  • iterate through columns of selected row and set individual field values in form to column values

If the above is correct, then let’s say I write the query results to a WebListBox excluding the Primary key of the table. Then if I wish to edit fields, I map row values to individual fields as above. How can I then track which row in database the record belongs to when performing an update on database?
Is it that I should return the primary key ID from query and store it in the CellTag property of WebListBox row if I do not want to display the ID to the end user?

Or should I incorporate EditRow and SaveRow methods of RowSet somehow in the above procedure?

Use RowTag to store the primary key.

2 Likes