Select statement dealing with quotes and web list

Keeping this simple, I have a select statement to populate a web list:

SQL_Select = "SELECT Item FROM table"

That’s all great until my field “Item” has a value in it which includes quotes.

Then Xojo blows up. You have to close the browser instance and reload for anything to work.

How do you properly handle field values that include quotes in Xojo?

i think you need to replace the double quote with double double quote in the string

so instead of this


do this instead

dim tmp as string tmp=REPLACEALL(data.Field("Item").StringValue,chr(34),chr(34)+chr(34)) DataList.AddRow(tmp)

Unfortunately that doesn’t seem to work.

It could be an encoding issue, ensure that when you write to the database and when you retrieve from it you are using the same encodings.

When you write to the database also use prepared statements which will ensure that apostophes and the like are dealt with correctly.

split the line DataList.AddRow(data.Field("Item").StringValue)
into two lines with a local variable, to see if the problem comes from the database or the weblistbox.
then use “debug” to step into each line to get where it fails.