TableMappings and FirstReturnedRecord

G

Greg

We manually assign tablenames to our Datatables. We do not use
TableMappings.

When calling DataAdapter.Update like this:
dim i as integer = 0

i = da.Update(dsChanges.Tables("myTable"))

and setting the InsertCommand to a insert sproc that returns the inserted
record with a Select after the insert, do we need to have TableMappings?

The insert sprocs returns the inserted row when I run it in Query Analyzer.
It does not when calling Update on DataAdapter.

i = 1 in the above example, the record is inserted into the sql table. The
client never gets the record back though so we still have the 'old' DataRow,
which is not marked 'Unchanged' (was 'Added').

I tried adding TableMappings right before the call to Update, same results.
 
D

David Sceppa

Greg,

I don't believe the problem you've described is an issue with
TableMappings. If you can supply some simple code to reproduce the problem
(minimal table schema, minimal stored procedure, and .NET code), someone
should be able to help.

David Sceppa
Microsoft
This posting is provided "AS IS" with no warranties,
and confers no rights. You assume all risk for your use.
© 2004 Microsoft Corporation. All rights reserved.
 
G

Greg Robinson

David, correct (and your book confirms this ;-))

The problem was a Select at the start of the insert and update sprocs
(checking for duplicate records). This was truly 'the
FirstReturnedRecord' as far as ADO.NET was concerend. I removed the
Selects and all is good now.
 
D

David Sceppa

Greg,

Thanks for following up. Glad to hear your problem is resolved, and
that the book was accurate. ;-)

David Sceppa
Microsoft
This posting is provided "AS IS" with no warranties,
and confers no rights. You assume all risk for your use.
© 2004 Microsoft Corporation. All rights reserved.
 

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