Ask Your Question

BASIC: Problem of apostrophe in SQL statement

asked 2019-11-07 11:28:33 +0100

lonk gravatar image

From this web page,, I copied the table and pasted into Calc.

image description

There is an apostrophe in cell E22 which is misspelling and has a conflict with ' in SQL statement.

This statement is not correct,

HolidayName = Replace(oSheet.GetCellByPosition(4,r).String,"'","’")​

Help me please.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2019-11-07 11:41:02 +0100

erAck gravatar image

updated 2019-11-07 11:43:02 +0100

To escape an apostrophe for an SQL query double it, like Queen''s.

And you should really make sure your data doesn't result in an SQL injection..

edit flag offensive delete link more


Dear @erAck ,

From the image, the apostrophe in cell E20 or E24, has no problem.

The problem with SQL statement is in cell E22, the apostrophe in it, is different from in cell E20 and E24.

lonk gravatar imagelonk ( 2019-11-07 18:06:22 +0100 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2019-11-07 11:28:33 +0100

Seen: 24 times

Last updated: Nov 07