Re: I Have No Identity
From: Miha Markic [MVP C#] (miha)
Date: 02/20/04
- Next message: Miha Markic [MVP C#]: "Re: Problem with OLE DB Provider"
- Previous message: Miha Markic [MVP C#]: "Re: dataset.getchanges fails to return changes"
- In reply to: Jerry Camel: "I Have No Identity"
- Next in thread: Jerry Camel: "Re: I Have No Identity"
- Reply: Jerry Camel: "Re: I Have No Identity"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 20 Feb 2004 11:07:46 +0100
Hi Jerry,
Scope_identity() is the right one.
About your problem: what do you mean that you get the whole table?
What is your scenario?
-- Miha Markic [MVP C#] - RightHand .NET consulting & software development miha at rthand com www.rthand.com "Jerry Camel" <rlrcstr@msn.com> wrote in message news:%23taobN09DHA.1816@TK2MSFTNGP12.phx.gbl... > This has been addressed several times and I've read several articles and > posts and I still can't get this to work. (This is VB .NET) > > My understanding is that if I append a select statement to my DataAdapter's > Insert statement that I should be able to get an updated resultset. I've > got this: > > INSERT INTO dbo.FD_Files (FileName, ExpireTime, PostedBy, HashName, > FileSize, Description) VALUES (@FileName, @ExpireTime, @PostedBy, @HashName, > @FileSize, @Description); SELECT FileID, FileName, ExpireTime, PostedBy, > HashName, FileSize, Description FROM dbo.FD_Files WHERE FileID = @@IDENTITY > > I've also tried using SCOPE_IDENTITY() - reagrdless, I always get the whole > table returned. > > I need to know the identity of the record I just added and I keep getting a > whole table. It's making me crazy. > > I've even tried setting the adapter's select command to SELECT FileID from > FD_Files WHERE FileID = SCOPE_IDENTITY() and re-filling the dataset. I get > the whole damned table. Why!!!!???? > > What am I missing? I've tried using the built in wizard which comes up with > an insert statement just like the one above and I still end up with the > whole table after I update. > > Can anyone shed some light on this? Thanks. > > Jerry > >
- Next message: Miha Markic [MVP C#]: "Re: Problem with OLE DB Provider"
- Previous message: Miha Markic [MVP C#]: "Re: dataset.getchanges fails to return changes"
- In reply to: Jerry Camel: "I Have No Identity"
- Next in thread: Jerry Camel: "Re: I Have No Identity"
- Reply: Jerry Camel: "Re: I Have No Identity"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|