在ms访问权限中增加字段 [英] increment the field in ms access

查看:59
本文介绍了在ms访问权限中增加字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好

我有一个名为"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

推荐答案

将该列的数据类型选择为自动编号".
Select datatype for that column to AutoNumber.


REPOST:
REPOST: how to generate auto number in msaccess[^]

First of all I would say, use AutoNumber datatype for your ID field.

For this question, you had closed it wrong.
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访问权限中增加字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆