2014-06-26 21 views
0

我有Sql數據庫與表名稱問題。在SQL中插入查詢HTML字符串

我想爲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字符串。

+0

你有什麼錯誤? – Sadikhasan

+0

MySQL或SQL Server? –

+0

它給錯誤:[接近「字體」:語法錯誤] 例外名稱:NS_ERROR_FAILURE –

回答

2

您在使用"第三插入值

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>' 
     ); 

裏面你也可以使用轉義有錯誤斜線

+0

是否在插入語句中替換「with」是 –

+0

是的。您必須這樣做 – Wanderer

+0

@Techy:刪除最後一個'「 '在你的代碼中。 – Wanderer

0

嘗試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>'); 

希望這有助於你。