Re: Get back uniqueid?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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

.



Relevant Pages

  • Re: Get back uniqueid?
    ... I already have this mapping in place for the uniqueid column. ... But it seems I can't access it through my generated Query, ... and the signature had it returning an int. ... int always returns 1 (probably indicating success). ...
    (microsoft.public.dotnet.framework.adonet)
  • [PATCH 1/2] Unpinned futexes v2 - part 1: indexing changes
    ... It changes the way futexes are ... The only obvious problem is that mremapcan move a private mapping ... -static inline struct list_head *hash_futex(struct page *page, int offset) ... -static inline int futex_wake ...
    (Linux-Kernel)
  • Re: [patch][rfc] nommu: reverse mappings for nommu to solve get_user_pages problem
    ... Add a reverse mapping system for nommu for anonymous pages to be able ... free slabs which may be used for vmas in future. ... static inline void set_page_refs(struct page *page, int order) ...
    (Linux-Kernel)
  • Re: Altix I/O code reorganization - 5 of 21
    ... -extern int xbow_attach; ... Big window mappings can be ... * any associated mapping resources. ... * Destroy a DMA mapping from crosstalk space to system address space. ...
    (Linux-Kernel)
  • [PATCH 03/18] fs: keep inode with backing-dev
    ... Having inode on writeback lists of a different bdi than ... inodes over when the mapping backing dev is changed. ... struct writeback_control *wbc, ... int ret, n; ...
    (Linux-Kernel)