sql server - Stored procedure problem in MS Access caused by ReturnsRecords (accdb) -


i have relatively stored procedure runs insert, , attempts return last inserted id. done can id via scope_identity(). working great me. then, got reports on machines, stored proc cause duplicate results.

after investigating it, found cause use of property returnsrecords. when true, run query twice! select; cares. case though, causing duplicates in database.

setting returnsrecords false gets rid of problem, defeats purpose of stored proc (i absolutely must proper last inserted id record)!

my question this: how go inserting record , getting id of new record, while getting around problem?

additional info:

  • i using dao
  • i have tried ado.command method, error prone , doesn't seem work output parameters me.
  • i using stored proc solely purpose of retaining scope. not have heart set on using stored proc. need reliable way id of last inserted row.
  • this accdb
  • this happening in access 2007
  • my db backend mssql server 2008

any or insight appreciated.

one of parameters in procedure can set output. still don't return rows, set value of parameter scope_identity()

create proc returnthenewid    @newvalue int   , @returnnewid int output  set nocount on  insert ....  set @returnnewid = scope_identity() 

Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -