簡體   English   中英

在SQL中插入查詢HTML字符串

[英]Insert Query for HTML string in SQL

我有表名稱為QUESTION的Sql數據庫。

我想將QuestionTitle的值作為html字符串插入。 插入查詢為

INSERT INTO 
   QUESTION (QuestionType,QuestionID,QuestionTitle) 
VALUES ("MRQ",
        "QNB5T6TKDMS",
        "<p><span style="font-family: comic sans ms,sans-serif; font-size: 
small;">what was the original concentration of the acid?</span></p>")

當我嘗試在Sql中執行此查詢時,出現錯誤。 我該怎么做,以便它適用於html字符串。

您在第三個插入值中使用"出錯

INSERT INTO 
   QUESTION (QuestionType,QuestionID,QuestionTitle) 
VALUES ('MRQ',
        'QNB5T6TKDMS',
        '<p><span style="font-family: comic sans ms,sans-serif; font-size: small;">
         what was the original concentration of the acid?</span></p>'
       );

您也可以使用轉義斜杠

像這樣嘗試somthiung:-

INSERT INTO QUESTION (QuestionType,QuestionID,QuestionTitle) VALUES 
('MRQ','QNB5T6TKDMS','<p><span style="font-family: comic sans ms,sans-serif; font-size: 
small;">what was the original concentration of the acid?</span></p>');

希望這對您有所幫助。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM