访问自动编号问题 [英] access autonumber problem
本文介绍了访问自动编号问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好
我在Access数据库中有表
我将ID字段设置为autonumber
当我将其连接到vb.net并使用新记录时,ID将小于零
当我关闭表格并再次打开它时,ID将为正数
为什么会这样?
我该如何解决?
hi all
i have table in an access database
and i set ID field as autonumber
when i connect it to vb.net and use new record , ID will be less than zero
when i close form and open it again , ID will be positive number
why is that ?
how can i solve it ?
推荐答案
我不确定您要使用哪种方法来添加新记录.它是这样工作的:
假设:
您正在使用DataTable和DataAdapter
-关于添加记录时,自动编号字段将使用负值(尚未插入数据库).
-添加新内容后,DB将生成一个职位编号作为ID.除非或直到再次选择该表,否则它不会在DataTable上更新.
I am not sure what method you are using to Add New record. This how it works:
Assumption:
You are using a DataTable and DataAdapter
- When you about the Add a record, the autonumber field will use a negative value (which is not insert into the database yet).
- Once you add new, DB will generate a position number as ID. But it will not get updated on the DataTable unless or until you select the table again.
这篇关于访问自动编号问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文