将信息插入SQL的表中

时间:2013-11-06 13:51:01

标签: sql ms-access

我正在尝试将新信息插入到现有表中。这是我的代码无效:

INSERT INTO customer (cNo, cName, street, city, county, discount)
VALUES (10, Tom, Long Street, Short city, Wide County, 2);

我要去哪里?

3 个答案:

答案 0 :(得分:4)

您必须使用引号作为字符串值:

INSERT INTO customer (cNo, cName, street, city, county, discount)
VALUES (10, 'Tom', 'Long Street', 'Short city', 'Wide County', 2);

答案 1 :(得分:3)

您没有正确指定字符串,应该是:

INSERT INTO customer (cNo, cName, street, city, county, discount) 
VALUES (10, 'Tom', 'Long Street', 'Short city', 'Wide County', 2);

答案 2 :(得分:2)

您必须使用逗号分隔值,并将文本字段用引号('')括起来。  检查this

试试这段代码:

INSERT INTO customer (cNo, cName, street, city, county, discount) 
VALUES (10, 'Tom', 'Long Street', 'Short city', 'Wide County', 2);