我插入一条记录,然后用select top 1 Id from News order by Id desc来查询自动生成的那个编号,老是取到上一条的,然后用System.Threading.Thread.Sleep(500);才能拿到当前生成的编号。
另外,用select @@ indentity和select Max(Id)这种应该也是差不多的
...全文
713打赏收藏
根据我的研究,Access生成自动编号大概要500毫秒
我插入一条记录,然后用select top 1 Id from News order by Id desc来查询自动生成的那个编号,老是取到上一条的,然后用System.Threading.Thread.Sleep(500);才能拿到当前生成的编号。 另外,用select @@ indentity和select Max(Id)这种应该也是差不多的