Command builder and retrieving autoincrement values

  • Thread starter Thread starter Maciek Januchowski
  • Start date Start date
M

Maciek Januchowski

Hi

I create insert command object with command builder and then
add "; SELECT SCOPE_IDENTITY() as primary_key_field" formula to
CommandText property of this object. I also set its UpdateRowSource
property to FirstReturnedRecord.

After calling update method of data adapter I do not get new
primary key value.

I did the same without using command builder (I create insert
command object in code "manually" and it's identical to the one
which is created by the command builder) and everything seems to work fine.
Do someone have any idea why retrieving autoincrement value
doesn't work when I use CommandBuilder?

Thanks for any clues

Maciek

ps. If you need to see a code example let me know.
 
This won't work. See my article on the Command(Don'tuse)Builder.
http://www.betav.com/msdn_magazine.htm


--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 
Back
Top