SQLite中的Android执行下面的查询时,我得到一个错误
sDataBase.execSQL(query);
插入到联系人(ID,名字,姓氏,******中国,EMAILID,状态)的值( 'ae0caa6a-8ff6-d63f-0253-110b20ac2127', 'XXX', 'XXX', '9008987887', 'xxx@gmail.com', '是'),( '9afab56e-a18a-47f2-fd62-35c78d8e0d94', 'YYY', 'YYY', '7890988909', 'yyy@gmail.com', '是'),('378d757a-ee60-07a4 -e8bc-396b402c3270' , 'ZZZ', 'ZZZ', '9000898454', 'zzz@gmail.com', '是')
注:这是在SQLServer的执行罚款,这是Android的SQLite得到错误。
Error: sqlite returned: error code = 1, msg = near ",": syntax error, db=/data/data/myapp.contactmanager/databases/webview.db
编辑1:我值仍然得到错误之间的增值空间
insert into Contacts(ID, FirstName, LastName, PhoneNumber, EmailId,Status) values
('ae0caa6a-8ff6-d63f-0253-110b20ac2127', 'xxx', 'xxx','9008987887', 'xxx@gmail.com', 'Yes'),
('9afab56e-a18a-47f2-fd62-35c78d8e0d94', 'yyy', 'yyy', '7890988909', 'yyy@gmail.com', 'Yes'),
('378d757a-ee60-07a4-e8bc-396b402c3270', 'zzz', 'zzz', '9000898454', 'zzz@gmail.com', 'Yes')
编辑2:更改使用查询是否有可能在SQLite数据库一次插入多行? 还是行不通
INSERT INTO Contacts
SELECT 'ae0caa6a-8ff6-d63f-0253-110b20ac2127' AS ID, 'xxx' AS FirstName, 'xxx' AS LastName, '9008987887' AS PhoneNumber, 'xxx@gmail.com' AS EmailId, 'Yes' AS Status,
UNION SELECT '9afab56e-a18a-47f2-fd62-35c78d8e0d94', 'yyy', 'yyy', '7890988909', 'yyy@gmail.com', 'Yes'
UNION SELECT '378d757a-ee60-07a4-e8bc-396b402c3270', 'zzz', 'zzz', '9000898454', 'zzz@gmail.com', 'Yes'
编辑3:我已经在同步状态的编辑2.最终是做了一个小错误before UNION i have included comma
,让我得到了一个错误。 现在删除, 做工精细 。
INSERT INTO Contacts
SELECT 'ae0caa6a-8ff6-d63f-0253-110b20ac2127' AS ID, 'xxx' AS FirstName, 'xxx' AS LastName, '9008987887' AS PhoneNumber, 'xxx@gmail.com' AS EmailId, 'Yes' AS Status
UNION SELECT '9afab56e-a18a-47f2-fd62-35c78d8e0d94', 'yyy', 'yyy', '7890988909', 'yyy@gmail.com', 'Yes'
UNION SELECT '378d757a-ee60-07a4-e8bc-396b402c3270', 'zzz', 'zzz', '9000898454', 'zzz@gmail.com', 'Yes'