@@IDENTITY after INSERT statement always returns 0

后端 未结 13 1178
一整个雨季
一整个雨季 2021-01-11 13:00

I need a function which executes an INSERT statement on a database and returns the Auto_Increment primary key. I have the following C# code but, while the INSERT statement w

13条回答
  •  抹茶落季
    2021-01-11 13:24

    Check your database settings. I had a similar problem a while ago and discovered that the SQL Server connection setting 'no count' was enabled.

    In SQL Server Management Studio, you can find this by right-clicking the server in the Object Explorer, select Properties and then navigate to the Connections page. Look at the settings for "Default connection options"

提交回复
热议问题