Re: Get back uniqueid?
- From: "Miha Markic" <miha at rthand com>
- Date: Wed, 5 Dec 2007 09:31:32 +0100
Here is the idea
a) you'd need a mapping between database column and your column, i.e. (Id <=> Id):
adapter.TableMapping.ColumnMappings.Add("Id", "Id");
b) you'd append this statement after the insert:
SELECT Id = SCOPE_IDENTITY()
BTW all this code is generated for you, if you drag & drop a table from Server Explorer to dataset designer - you could try and see what code it generates.
--
Miha Markic [MVP C#, INETA Country Leader for Slovenia]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/
"benji" <benji@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:1F0FCA65-3644-4A5A-9DC8-7654D2A23BC9@xxxxxxxxxxxxxxxx
Hi Miha,
I added another query to the table, which was an insert query. I then
appended:
;SELECT Scope_Identity()
it compiled fine. It generated the expected insert method in the
tableadapter class, and the signature had it returning an int. However, the
int always returns 1 (probably indicating success). Could you go into more
detail regarding what you mean by " Depends on the mappings associated with
DataAdapter."? Thanks...
.
- References:
- Re: Get back uniqueid?
- From: Miha Markic
- Re: Get back uniqueid?
- From: Miha Markic
- Re: Get back uniqueid?
- From: benji
- Re: Get back uniqueid?
- Prev by Date: RE: Event Handling for ColumnChanging
- Next by Date: Re: Transactions and ASP.NET Membership
- Previous by thread: Re: Get back uniqueid?
- Next by thread: Re: Get back uniqueid?
- Index(es):
Relevant Pages
|