473,394 Members | 2,002 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

concurrency violation

>From reading this group and the documentation on msdn
(http://msdn.microsoft.com/library/de...classtopic.asp)
I see that the DataAdapter (for ADO.Net) will throw a
DBConcurrencyException for an update or delete command when the number
of rows affected is zero in the data base. I need to learn how to turn
that expected behavior off in ADO.Net 1.1.

I need to be able to submit a delete command (think sql of "delete
tableName where primaryKey = 'primaryKeyValue'") that may not affect
any a row in the data base for a given table. I do not want to have to
go against the data base twice (once to see if a row exists and second
to delete a row) - I am anti-IO and like to keep it to a minimum.

Here is my use case:

I am using optimistic locking for a three tier app (it was decided that
last in will always win - business decision). Smart Client (.Net)
frontend, webservice middle (.ASMX), with Oracle on the backend. The
middle consumes the dataset from the database to create an xml document
and passes that document to the smart client. The smart client sends
the xml document back to the webservice (it could be a brand spanking
new document for all the webservice cares). The webservice flattens
the xml document into the various database tables. But first, we must
delete all the data first assocated with the primary key (it is
referenced in many database tables) so that I can now add it back to
the database. This all happens (delete and insert) in a single
transaction. I only want to touch the database associated with the
data twice - once when I fetch the data for dispursement and second
when I put it back.

I am gun shy with IO performance. When I have a command(s) to execute,
I open a connection and close it upon completion of the command(s). I
do not have any open connection laying around. All exceptions roll
back the transaction with no possibility for parole.

So correct me if I am wrong, but it looks like to avoid
DBConcurrencyException I need to go to the database three times - once
for dispursement (IO for database), a second time to get identical data
that we got when we dispursed the data the first time (IO for
database), and then the third time to delete and insert (IO for
database). I will not keep data laying around hoping it will come
back; plus that would violate heuristic OO practices.

With all that said, does anyone see another alternative? (We do have
the ability to send the dataset to the client, but the client won't
remember the dataset either, it will treat all xml documents as a new
fresh begining.) Is there an ADO.Net setting I can use but cannot find
in the documentation? Any idea(s) will be appreciated.

Cheers,

Gerald

Jul 21 '05 #1
2 1170
Gerald,

Your question is typical for the newsgroup framework.adonet.

Adonet
news://msnews.microsoft.com/microsof...amework.adonet

Web interface:
http://communities2.microsoft.com/co...amework.adonet

However I assume that your problem is to complex to answer in a newsgroup
(at least for me). The answers will probably be to buy a book by instance
from David Sceppa, the most recomended or from William Vaughn the second one
named in these newsgroups.

(I did not read them both so I have no opinion which one is the best)

I hope that this helps anyway,

Cor
Jul 21 '05 #2
Cor,

Thank you for the links. I read Sceppa's book a few years ago. Thank
you for your suggestion to re-exame the book. On page 504 it tell me
how to turn it off (the DataAdapter has a ContinueUpdateOnError
property) of which I will have to digest the implications. Thanks you.

Cheers,

Gerald

Jul 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Billy Jacobs | last post by:
I have a client who is getting a concurrency violation error whenever she tries to update a record. I can log in to the site as her simultaneously and update the record with no problem. I can...
25
by: nick | last post by:
I'm having trouble updating from a datagrid. It's says "Concurrency violation: the UpdateCommand affected 0 records", though I can't see how it's related to "concurrency". I can insert and delete...
2
by: Niyazi | last post by:
Hi, I have not understand the problem. Before all the coding with few application everything worked perfectly. Now I am developing Cheque Writing application and when the cheque is clear the...
4
by: Steven Nagy | last post by:
Hi Have a problem that consistantly occurs in my applications where using a DataAdapter (OLEDB) and a dataset. Using a simple process of adding a row to the dataset table and then calling the...
2
by: Vladimir Oľura | last post by:
I am building a pocket pc application that requires a datagrid. I am inserting a new row this way: private void mInsert_Click(object sender, System.EventArgs e) { try { DataRow dr =...
4
by: Jerry | last post by:
Hi, I have an app which retrieves data from a sql server table and displays it on a datagrid. If 2 sessions of this app are running and 2 users try to update the same record at about the same...
2
by: Agnes | last post by:
I got a simple form and using databinding manager to do the add new Now , my big trobule is . I can update the 'addnew' record, However, after I new the record, and then amend it , it got...
2
by: Agnes | last post by:
For the previous post(2 months ago), I think I had solved the problem however, i got the same error Form A (tableA) (after insert the new record , save it, and then amend the record, )no...
2
by: BobAchgill | last post by:
Do you know why this error might be happening? Maybe it is because I have two data adapters open on the same MDB file?? If this is the problem... how can I keep them from disturbing each other?...
5
by: Vayse | last post by:
In my save code, most of items save fine. But sometimes I get a concurrency violation message. "Concurrency violation: the UpdateCommand affected 0 of the expected 1 records." It happens on the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.