I am following the Xojo Introduction to programming guide specifically page 226 regarding the SQLify method.
Here is the code I wrote:
Var result As String
result = source.ReplaceAll(“'”, “’ '”)
Return result
Here is the error I get:
Window1.SQLify, line 2
This item does not exist
result = source.ReplaceAll(“'”, “’ '”)
Window1.SQLify, line 2
There is more than one method with this name but this does not match any of the available signatures.
result = source.ReplaceAll(“'”, “’ '”)
Window1.SQLify, line 2
Type mismatch error. Expected String, but got Int32
result = source.ReplaceAll(“'”, “’ '”)
None of the previous steps have shown any errors when I run the project, (well, not now anyway).
“source” comes from wherever you call sqlify from. There is a good example in the programming guide.
Put a button on the window and in the Pressed event, put
var s as string = "isn't this pleasant"
var t as string = sqlify(s) // s becomes "source" in the sqlify method
break
Examine the contents of both s and t to see the efffects of sqlify.
Note: if you try to send s to the database, it will break. If you send t, it will succeed and the database will contain the contents of s.
Note 2: This example is ancient and out of favor. It still works, and used to be the only way to go, but the better way is to use prepared statements to send data to the database. But it’s not a bad exercise to get used to creating methods and calling them.