What should I do with single quotes in the data inserted in the SQL statement?

xiaoxiao2021-03-06  104

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.

转载请注明原文地址:https://www.9cbs.com/read-123500.html

New Post(0)