.NETGURU
Bug in DataAdapter Update?
Messages   Related Types
This message was discovered on ASPFriends.com 'aspngescalate' list.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.

Jesse Liberty (VIP)
I posted this (twice) to aspngData and received no answers at all. This is
pretty urgent for me as I'm writing about this feature on deadline...

Is this a bug or am I missing something?

I follow these steps:

1) populate a dataset from two tables in the db (into one table in the
dataset)
2) modify one or more records in the dataset
3) hand-modify the record in the db (simulating a concurrency problem)
4) update the db from the dataset by calling dataAdapter.Update()

I've set an update command object which calls a sproc
That sproc takes many params including all the new values
and all the original values (from
param.sourceVersion&#da;taRowVersion.original)
Thus the sproc is something like
update table1 set field1 &# n;ewValue, field2 &# n;ewValue where field1 oldValue and field2 &# o;ldValue

This causes a concurrency failure and the where clause in the sql statement
fails (as it should)

The database is NOT updated (and it should not be - the where statement
fails)

But here's the problem: the dataAdapter.Update returns 1 row updated (when
it should return 0) and no concurrency excpetion is thrown.

If I do not alter the record concurrently, then the update does happen
(good) and still dataAdapter.Update still returns 1 row updated.

The bug is that I think it should return 0 rows updated (and throw a
concurrency exception) when it can not update. Am I missing something?

I'm at a loss.

Thanks.

-j
-------------------------------
Jesse Liberty
Reply to this message...
 
    
Mitch Denny (VIP)
Jesse,

Might be a wild stab in the dark here, but it might be
something to do with the fact that you are running a sproc,
and from the DataAdapter's point of view everything is
working nicely.

Have you got some code?

----------------------------------------
- Mitch Denny
- http://www.warbyte.com
- Click here to reveal e-mail address
- +61 (414) 610-141
-

-----Original Message-----
From: Jesse Liberty [mailto:Click here to reveal e-mail address]
Sent: Thursday, 6 September 2001 10:55 PM
To: aspngescalate
Subject: [aspngescalate] Bug in DataAdapter Update?

I posted this (twice) to aspngData and received no answers at all. This
is pretty urgent for me as I'm writing about this feature on deadline...

Is this a bug or am I missing something?

I follow these steps:

1) populate a dataset from two tables in the db (into one table in the
dataset)
2) modify one or more records in the dataset
3) hand-modify the record in the db (simulating a concurrency problem)
4) update the db from the dataset by calling dataAdapter.Update()

I've set an update command object which calls a sproc
That sproc takes many params including all the new values
and all the original values (from
param.sourceVersion=dataRowVersion.original)
Thus the sproc is something like
update table1 set field1 = newValue, field2 = newValue where field1
= oldValue and field2 = oldValue

This causes a concurrency failure and the where clause in the sql
statement fails (as it should)

The database is NOT updated (and it should not be - the where statement
fails)

But here's the problem: the dataAdapter.Update returns 1 row updated
(when it should return 0) and no concurrency excpetion is thrown.

If I do not alter the record concurrently, then the update does happen
(good) and still dataAdapter.Update still returns 1 row updated.

The bug is that I think it should return 0 rows updated (and throw a
concurrency exception) when it can not update. Am I missing something?

I'm at a loss.

Thanks.

-j
-------------------------------
Jesse Liberty

| [aspngescalate] member Click here to reveal e-mail address = YOUR ID |
http://www.asplists.com/asplists/aspngescalate.asp = JOIN/QUIT

Reply to this message...
 
    
Dan Green (VIP)
On behalf of Jesse...

----- Original Message -----
From: Jesse Liberty
To: aspngdata
Sent: Thursday, September 06, 2001 11:37 PM
Subject: [aspngdata] RE: Bug in dtaAdapter.Update()

I figured this out. The problem was that the sproc was updating more than
one table, and thus the final value for @@rowcount returned was greater than
0, confusing the data adapter.

Thanks.

-j

----- Original Message -----
From: "Mitch Denny" <Click here to reveal e-mail address>
To: "aspngescalate" <Click here to reveal e-mail address>
Sent: Sunday, September 09, 2001 2:11 AM
Subject: [aspngescalate] RE: Bug in DataAdapter Update?

[Original message clipped]

Reply to this message...
 
 
System.Data.Common.DataAdapter




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification