问题描述
大家好
我有一个名为"tblDBUser"的表
有字段的
intDBUserId,strLogin,strName,strPassword,intDBRoleType
当我输入记录时,我希望其中的intDBUserId应该自动增加,
我写了一个如下查询.......................................
hello all
i have a table named as "tblDBUser"
that having fields
intDBUserId,strLogin,strName,strPassword,intDBRoleType
in which i want that intDBUserId should be incremented automatically when i enter the records,
i write a query which is as followa...........................
INSERT INTO tblDBUser (intDBUserId,strLogin,strName,strPassword,intDBRoleType)
values((select MAX(intDBUserId)+1 from tblDBUser
,strLogin,strName,strPassword,intDBRoleType));
问题是它显示错误
查询值的数量与目标字段的数量不同",您能帮我解决我在哪里出错的错误吗?
感谢和问候
subiya
the problem is it is shows the error
"number of query values is not same the destination fields" can u please help me out where i made a mistake
thanks and regards
subiya
推荐答案
INSERT INTO tblDBUser (intDBUserId, strLogin,strName,strPassword,intDBRoleType)
values((select MAX(intDBUserId)+1 from tblDBUser), strLogin,strName,strPassword,intDBRoleType);
如果使用自动编号,则仅需使用以下内容. intDBUserId将自动生成.
If you use AutoNumber, you have to use following only. intDBUserId will automatically be generated.
INSERT INTO tblDBUser (strLogin,strName,strPassword,intDBRoleType)
values(strLogin,strName,strPassword,intDBRoleType);
这篇关于在ms访问权限中增加字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!