Command builder and retrieving autoincrement values

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.
 
W

William \(Bill\) Vaughn

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.
__________________________________
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top