提问人:Meenor Ranpura 提问时间:5/30/2018 更新时间:5/30/2018 访问量:124
将数据插入表中,给出语法错误 SWIFT
insert data into table giving syntax error SWIFT
问:
我从 API 获取数据,这是我的回复
{
author = "Joanne Chiu";
description = "Asian stock markets tumbled Wednesday following overnight declines in the U.S. and Europe. Key markets including Japan, Hong Kong and mainland China fell more than 1.5%. Japan\U2019s Nikkei average shed 1.7% to hit a six-week low, while South Korea\U2019s KOSPI slipped\U2026";
publishedAt = "2018-05-30T05:04:26Z";
source = {
id = "the-wall-street-journal";
name = "The Wall Street Journal";
};
title = "Asian Stocks Down, Following Global Concerns Over Italy's Political Turmoil";
url = https://www.wsj.com/articles/asian-stocks-down-following-global-concerns-over-italys-political-turmoil-1527656546;
urlToImage = https://images.wsj.net/im-12406/social;}
我想将所有数据存储到数据库中。这是我的查询
let query : NSString = NSString(format: "insert into newsData (sourceName, authorName, title, description, url, urlToImage, publishedAt) values (%@, %@, %@, %@, %@, %@, %@)", sourceName, authorName, title, description, url, urlToImage, publishedAt)
但它给了我一个语法错误
执行查询“靠近”墙“时出错:语法错误
我以为这是因为特殊字符“-”,所以删除了它,但它仍然给了我同样的错误
答: 暂无答案
评论
'%@'
'
)