本文介绍了如何在MS Access中不设置为自动编号的情况下增加主键值(ID)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
HI
我创建了用于获取Stop-ID最大值的视图,因此在StopNew()函数中,我将向该Max Stop-ID加1.
HI
i created view for getting the maximum value of Stop-ID,So in StopNew() function i will add 1 to that Max Stop-ID
public void StopNew()
{
this.MaxStopIDbindingSource.EndEdit();
stopBindingSource.AddNew();
this.MaxStopIDbindingSource.MoveFirst();
((DataRowView)this.stopBindingSource.Current).Row["nStopID"] = (int)((DataRowView)this.MaxStopIDbindingSource.Current).Row["nID"] + 1;
}
但是最大ID不会在运行时更新.这意味着视图值不会在运行时更新.
but the max ID will not update in runtime, means view value will not updated in runtime.
推荐答案
这篇关于如何在MS Access中不设置为自动编号的情况下增加主键值(ID)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!