473,387 Members | 1,388 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,387 software developers and data experts.

Help understanding database changes

Hi, I don't have a code problem. I have an understanding problem.

This is a made up situation that mimics my real situation but it is
easier to understand.

1. I call a web method with an account number and retrieve an employee
object called employee on computer 1 (user 1). The employee object
getFirstName() returns "Michelle".

2. I repeat the process on computer 2 as above for the same account
number using the same web method (user 2). The employee object
getFirstName() returns "Michelle"

3. (user 1) I call employee.setFirstname("Mary") and then I invoke
employee.save(). The web method is called and the database for the
employee is saved.

4. (user 3) I perform a SELECT statement in the database and can see
that the table now contains 'Mary'.

5. (user 2) I call employee.setFirstname("Margaret") and then I invoke
employee.save(). The web method is called but an exception is raised.
When I query the database it still shows "Mary".

This is the behaviour I want but I do not know how it works. If I was
using a database where I had a connection for each user this behaviour
is easy to understand. But as I am using a web method and there is no
explicit connection to the database, and each user probably uses the
same database connection, I don't know how it is done.

I think it must work like this but is this right?

"Employee carries around an old copy with itself, and before doing an
update of the database, reads from the database, compares with the old
copy, and throw an exception if changed. "

The observed behaviour is what I want but would like clarification that
I am thinking how it is done is correct.

Thank you for when you help.
Mark

May 12 '06 #1
2 1185
> "Employee carries around an old copy with itself, and before doing an
update of the database, reads from the database, compares with the old
copy, and throw an exception if changed. "
There's your answer, in pseudocode. When a user fetches an employee record
from the database, the data in it is stored in an object. Add a parameter to
your WebMethod that takes the value that is on the client. Use that
parameter value to check the database. The client passes the currently-held
value on the client to the method. If it is the same as the record on the
server, it works. Otherwise not.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Hard work is a medication for which
there is no placebo.

"Mark" <ma*******@hotmail.com> wrote in message
news:11**********************@u72g2000cwu.googlegr oups.com... Hi, I don't have a code problem. I have an understanding problem.

This is a made up situation that mimics my real situation but it is
easier to understand.

1. I call a web method with an account number and retrieve an employee
object called employee on computer 1 (user 1). The employee object
getFirstName() returns "Michelle".

2. I repeat the process on computer 2 as above for the same account
number using the same web method (user 2). The employee object
getFirstName() returns "Michelle"

3. (user 1) I call employee.setFirstname("Mary") and then I invoke
employee.save(). The web method is called and the database for the
employee is saved.

4. (user 3) I perform a SELECT statement in the database and can see
that the table now contains 'Mary'.

5. (user 2) I call employee.setFirstname("Margaret") and then I invoke
employee.save(). The web method is called but an exception is raised.
When I query the database it still shows "Mary".

This is the behaviour I want but I do not know how it works. If I was
using a database where I had a connection for each user this behaviour
is easy to understand. But as I am using a web method and there is no
explicit connection to the database, and each user probably uses the
same database connection, I don't know how it is done.

I think it must work like this but is this right?

"Employee carries around an old copy with itself, and before doing an
update of the database, reads from the database, compares with the old
copy, and throw an exception if changed. "

The observed behaviour is what I want but would like clarification that
I am thinking how it is done is correct.

Thank you for when you help.
Mark

May 12 '06 #2
I would guess that the client is caching a copy of what the data was
like before modification. When you call save() this copy is compared
with the database to test if any changes have been made by anyone else.

1) Does the client run a select command to fetch the original values
before commiting the data (thus the client performs the comparison)?

2) Does the client send to the web method both the original values and
the new values (thus the server performs the comparison)?
I've seen this when using SqlTableAdapters (especially if you have the
table adapter generate stored procedures for you).
On 12 May 2006 12:50:01 -0700, "Mark" <ma*******@hotmail.com> wrote:
Hi, I don't have a code problem. I have an understanding problem.

This is a made up situation that mimics my real situation but it is
easier to understand.

1. I call a web method with an account number and retrieve an employee
object called employee on computer 1 (user 1). The employee object
getFirstName() returns "Michelle".

2. I repeat the process on computer 2 as above for the same account
number using the same web method (user 2). The employee object
getFirstName() returns "Michelle"

3. (user 1) I call employee.setFirstname("Mary") and then I invoke
employee.save(). The web method is called and the database for the
employee is saved.

4. (user 3) I perform a SELECT statement in the database and can see
that the table now contains 'Mary'.

5. (user 2) I call employee.setFirstname("Margaret") and then I invoke
employee.save(). The web method is called but an exception is raised.
When I query the database it still shows "Mary".

This is the behaviour I want but I do not know how it works. If I was
using a database where I had a connection for each user this behaviour
is easy to understand. But as I am using a web method and there is no
explicit connection to the database, and each user probably uses the
same database connection, I don't know how it is done.

I think it must work like this but is this right?

"Employee carries around an old copy with itself, and before doing an
update of the database, reads from the database, compares with the old
copy, and throw an exception if changed. "

The observed behaviour is what I want but would like clarification that
I am thinking how it is done is correct.

Thank you for when you help.
Mark

May 12 '06 #3

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

Similar topics

9
by: Dom Boyce | last post by:
Hi First up, I am using MS Access 2002. I have a database which records analyst rating changes for a list of companies on a daily basis. Unfortunately, the database has been set up (by my...
6
by: Mark Reed | last post by:
Hi all, I am trying to learn a little about programming (I know next to nothing so far) and have found some code which hides the toolbars. However, this bit of code is a little too effective and...
6
by: JACK GUNAWAN via AccessMonster.com | last post by:
Hi, I have trouble setting up an access database on a wan because I am using dial up which charges per minute. How can I get the database to be sharred across miles with much stability and lower...
8
by: jmarzion | last post by:
I am trying to convert an old VB4.0 application to VB.net and I am pulling my hair out over understanding changes in database connections, etc. I am using a ACCESS database. In the old code, if...
9
by: MrHelpMe | last post by:
Hello again experts, I have successfully pulled data from an LDAP server and now what I want to do is drop the data into a database table. The following is my code that will insert the data but...
5
by: AAJ | last post by:
Hi all FIRST THE BORING BITS....... I normally use a Database layer, a Business layer and a GUI layer. The GUI uses an Object data source to bind to the Business layer which in turn binds...
0
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help wanted...
1
by: Dan Rolfe | last post by:
Ok I just kinda stumbled upon an error I made when I was building this database. It is a multitable relational DB consisting of 2 levels of grouping. Here is a rough design view: Owner...
53
by: souporpower | last post by:
Hello All I am trying to activate a link using Jquery. Here is my code; <html> <head> <script type="text/javascript" src="../../resources/js/ jquery-1.2.6.js"</script> <script...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.