What should I do with single quotes in the data inserted in the SQL statement?
Keywords: Access, SQL Server, ASP
In SQL, INSERT INTO YOTABLE (F1, F2) VALUES (100, 'ABC') string data is outside the single quotes, if the inserted data contains single quotes, you need to process, you can replace single quotes Both single quotes, two consecutive single quotes in SQL represent a single quotes characters, such as INSERT INTO YOTABLE (F1, F2) VALUES (100, 'AB'' C "means inserted new record F2 fields to ab ' c Use the function Replace to implement this feature: Replace (Yourstr, "'", "' ')
In .Net, there is no single quotue in the input data. If so, automatically set a single quotation to two single quotes.