主键自动编号类型 [英] Primary key Auto Number Type
本文介绍了主键自动编号类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我有一个带有自动数字类型键的数据库,我想通过数据命令插入数据.
我想在不插入主键字段的情况下将数据从VB.NET表单插入表中,
我的意思是我想插入除主键之外的所有字段.
我希望主键自动取值,但尝试时会出现错误.
Hi everybody,
I have a database with auto number type key, I would like to insert data by data command.
I would like to insert data into table from VB.NET form without inserting Primary key Field,
What I mean is I would like to insert all fields except primary key.
I would like the primary key to take value automatic, but when I try it, I see an error.
推荐答案
同意Amir.
正确的错误消息是查询值和目标字段的数量不同 [ ^ ]
不要在查询中包括自动编号"列.
错误
Agree with Amir.
The right error message is Number of query values and destination fields are not the same[^]
Don''t include the AutoNumber column in your query.
Wrong
INSERT INTO EMP(AutoNo, Name, Age, Phone) VALUES(1,'Employee1','25','435435345')
INSERT INTO EMP(AutoNo, Name, Age, Phone) VALUES('Employee1','25','435435345')--You query must be like this one
右
Right
INSERT INTO EMP(Name, Age, Phone) VALUES('Employee1','25','435435345')
这篇关于主键自动编号类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文