Someone taught me (Spikey I think? Or even Infratec?? I'm not too old to learn) to avoid the whole apostrophe issue is to paramaterise all variables passed to statements and queries
Databasehandle is the handle to your opened database.
0, is the first variable index you want to paramaterise.
And of course, "Uncle John's Roadhouse" is the problem string.
Then you just pass the query like this:
result = DatabaseQuery(#dbaseID,"SELECT * FROM title WHERE title = ?"
You can have more than one 'prepared' variable this this way, just increase the index
Someone else mentioned to me that you cannot pass table names like that but then you would not name tables like that, only strings and by the look of your query, TableName isn't actually a table's name.
result = DatabaseQuery(#dbaseID,"SELECT * FROM title WHERE title = '" + tablename + "'")
Fangbeast is right: tablename is between apostrophes in this query, so is treated as a string and not as a variable, so SetDataBaseString() must work and will handle apostrophes and even quotes without problems.
result = DatabaseQuery(#dbaseID,"SELECT * FROM title WHERE title = '" + tablename + "'")
Fangbeast is right: tablename is between apostrophes in this query, so is treated as a string and not as a variable, so SetDataBaseString() must work and will handle apostrophes and even quotes without problems.
He's made a mistake though I think. Why would you try to check if a title is the same as a tablename? I don't think he intended to do that somehow.
More likely he was searching for a title in a table. Just guessing.