SELECT @@IDENTITY in Access always returning 0

前端 未结 4 1716
清歌不尽
清歌不尽 2021-01-25 13:39

I have been trying to find a solution to this problem but so far nothing worked.

private void Insert()
    {
        string ConnectionStringAccess = Provider=Mic         


        
4条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-25 14:35

    The ms access db is 2003 or older (not sure exactly)

    I was able to recreate your issue with an Access 97 database. SELECT @@IDENTITY worked correctly with an Access 2000 database file (even when run from the same OleDbCommand object as the INSERT), but it always returned zero when run against an Access 97 database.

    It appears that you will need to upgrade your database file to a newer version if you want SELECT @@IDENTITY to work.

提交回复
热议问题