Populating Data from Database to ListBox for WebApp

Hi,
I am trying to retrieve data from a database as described in Chapter.12 in the basic tutorial for programming with Xojo, by using method Populate, with following code:

Var sql As String
Var rs As RowSet
sql = "SELECT name, email "
sql = sql + "FROM addressbook "
If TextField1.Text <> “” Then
sql = sql + “WHERE LOWER(name) LIKE LOWER(’%” + _
SQLify(TextField1.Text) + "%’) "
sql = sql + “OR LOWER(email) LIKE LOWER(’%” + _
SQLify(TextField1.Text) + “%’) "
End If
sql = sql + “ORDER BY name”
Try
rs = MyDatabase.SelectSQL(sql)
EmailAddressBox.RemoveAllRows
While Not rs.AfterLastRow
EmailAddressBox.AddRow(rs.Column(“name”).StringValue)
EmailAddressBox.CellValueAt(EmailAddressBox.LastAddedRowIndex, 1) = _
rs.Column(“email”).StringValue
rs.MoveToNextRow
Wend
Catch error As DatabaseException
MessageBox(error.Message)
End Try

THE ERRORS ARE:
“This item does not exist” and “Syntax Error” for line 18
rs.Column(“email").StringValue
where “email” is highlighted.

Please for advice,
Thank you

Hi Stevan,

Congratulations for getting this far. If you copied the code directly from the tutorial then the problem is the " before email is not a standard " and that is breaking your code. Just delete that " and replace it with a new one & all should be good.

1 Like

Yes, I saw that, thank you @Wayne_Golding .
I jump back and forward the chapters to develop e-commerce web solution, so I lack of focus for details.