问题
I need to know how to get last inserted row's identity in a table of MS Access
i am doing like:
in query at the end i have written this statement "Select @OutputId = SCOPE_IDENTITY()"
and in code i did
OLEDBParameter param = new OLEDBParameter();
param.ParameterName = "@OutputId";
param.Value = 0;
param.Direction = ParameterDirection.Output;
but i am getting this error: "System.Data.OleDb.OleDbDataAdapter internal error: invalid parameter accessor:"
Is there any way to solve this problem?
回答1:
To select the last autonumber against a connection, you can use @@Identity.
SELECT @@identity
来源:https://stackoverflow.com/questions/12301967/how-to-get-last-inserted-row-identity-in-a-table-of-ms-access