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

updating data on the same web form via 2 pc's

if 2 people are working on the same web site is it possible to be able
to work on it Simultaneously so that if i for example was to change
something it would change on the other persons screen after a refresh

Jan 16 '07 #1
7 1149
<cm******@hotmail.comwrote in message
news:11**********************@11g2000cwr.googlegro ups.com...
if 2 people are working on the same web site is it possible to be able
to work on it Simultaneously so that if i for example was to change
something it would change on the other persons screen after a refresh
Absolutely, assuming both users are working with the same data, and the data
is not user-specific...
Jan 16 '07 #2
for example, if you have a gridview on the page, and both users have the
gridview on screen with the same 20 records. they each edit a different row
and hit update or whatever. when the page reloads, they will see the
changes made by the other person. if they changed the same row, it will be
a case of "last one wins" unless you do some conflict checking in your
database code / layer.

tim

"Mark Rae" <ma**@markNOSPAMrae.comwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
<cm******@hotmail.comwrote in message
news:11**********************@11g2000cwr.googlegro ups.com...
>if 2 people are working on the same web site is it possible to be able
to work on it Simultaneously so that if i for example was to change
something it would change on the other persons screen after a refresh

Absolutely, assuming both users are working with the same data, and the
data is not user-specific...
Jan 16 '07 #3
"Tim Mackey" <ti********@community.nospamwrote in message
news:FE**********************************@microsof t.com...
for example, if you have a gridview on the page, and both users have the
gridview on screen with the same 20 records. they each edit a different
row and hit update or whatever. when the page reloads, they will see the
changes made by the other person. if they changed the same row, it will
be a case of "last one wins"
Yes indeed.
unless you do some conflict checking in your database code / layer.
Doesn't everyone...?
Jan 16 '07 #4
>unless you do some conflict checking in your database code / layer.
>
Doesn't everyone...?
i guess not, me at least! i never saw the point of the following delete
query (generated by VS / ado.net with optimistic concurrency)

delete from table where PK = 5 and
CompareEveryOtherColumnValueToSeeIfItChanged
i much prefer: delete from table where PK = 5

if a user wants to delete a record, it doesn't matter (to me at least)
whether the data changed or not, it is still destined for the trash, as
decided by the user. there is obviously very good reason for conflict
checking with update statements, but even then, one assumes that the user
would not want to proceed with the udpate if they knew that other values in
the record had changed. this wouldn't always be true. the user might prefer
that their statement get executed, rather than be told that someone else
beat them to it and have their statement rejected. in most of the apps i
develop, it doesn't matter if an edit is done and then silently overwritten
by a subsequent edit of the same record, typically because the data would be
overwritten anyway (with or without a conflict), in any case, there is no
effective loss of data. certainly there are situations where this is bad,
but i don't encounter them very often.

tim

Jan 16 '07 #5
"Tim Mackey" <ti********@community.nospamwrote in message
news:0A**********************************@microsof t.com...
decided by the user. there is obviously very good reason for conflict
checking with update statements, but even then, one assumes that the user
would not want to proceed with the udpate if they knew that other values
in the record had changed.
Ah yes, but what if they *didn't* know...?

Scenario:

User A opens Record 1

User B opens Record 1, having no clue that User A also has Record 1 open

User A changes 99 of the 100 fields in Record 1 and clicks the Save button

User A logs out

User B changes the other field in Record 1 and clicks the Save button,
thereby overwriting all of User A's changes

User B logs out

Neither User A nor User B has the slightest notion of what has just
happened, until / unless User A opens Record 1 again and wonders where all
the changes went...
Jan 17 '07 #6

If you're using SqlServer, you can use a DATATYPE called "timestamp".

A timestamp is a value that increments each time a record is updated. You
don't have to manually do this, it just happens.
Create Table dbo.Employee (EmpID int , RowVers timestamp , LastName
varchar(24 ) )

INSERT INTO dbo.Employee ( EmpID , LastName ) values ( 101, 'Jones' )
INSERT INTO dbo.Employee ( EmpID , LastName ) values ( 102, 'Smith' )
INSERT INTO dbo.Employee ( EmpID , LastName ) values ( 103, 'Gates' )

Select * from dbo.Employee

Select EmpID , convert ( int , RowVers ) as RowVersAsInt , LastName from
dbo.Employee

Converting to an int the easiest way to deal with this.

When you load an Employee (for possible edit) ...... you also persist (on
the webpage , or as custom business entity), the RowVersInt value.

Then when you update the Employee, you check to see if the RowVersInt has
changed.
@EmpID int
@LastName varchar(24)
@RowVersInt int

if exists (Select * from dbo.Employee e where e.EmpID = @EmpID and
convert(int , e.RowVers) <@RowVersInt )
begin
err.raise 'Ahhhhhhhh, somebody already updated this employee',
.........................
end
something like that.

<cm******@hotmail.comwrote in message
news:11**********************@11g2000cwr.googlegro ups.com...
if 2 people are working on the same web site is it possible to be able
to work on it Simultaneously so that if i for example was to change
something it would change on the other persons screen after a refresh

Jan 17 '07 #7
very nice. i like that approach.
thanks for posting

"sloan" <sl***@ipass.netwrote in message
news:eg**************@TK2MSFTNGP03.phx.gbl...
>
If you're using SqlServer, you can use a DATATYPE called "timestamp".

A timestamp is a value that increments each time a record is updated. You
don't have to manually do this, it just happens.
Create Table dbo.Employee (EmpID int , RowVers timestamp , LastName
varchar(24 ) )

INSERT INTO dbo.Employee ( EmpID , LastName ) values ( 101, 'Jones' )
INSERT INTO dbo.Employee ( EmpID , LastName ) values ( 102, 'Smith' )
INSERT INTO dbo.Employee ( EmpID , LastName ) values ( 103, 'Gates' )

Select * from dbo.Employee

Select EmpID , convert ( int , RowVers ) as RowVersAsInt , LastName from
dbo.Employee

Converting to an int the easiest way to deal with this.

When you load an Employee (for possible edit) ...... you also persist (on
the webpage , or as custom business entity), the RowVersInt value.

Then when you update the Employee, you check to see if the RowVersInt has
changed.
@EmpID int
@LastName varchar(24)
@RowVersInt int

if exists (Select * from dbo.Employee e where e.EmpID = @EmpID and
convert(int , e.RowVers) <@RowVersInt )
begin
err.raise 'Ahhhhhhhh, somebody already updated this employee',
........................
end
something like that.

<cm******@hotmail.comwrote in message
news:11**********************@11g2000cwr.googlegro ups.com...
>if 2 people are working on the same web site is it possible to be able
to work on it Simultaneously so that if i for example was to change
something it would change on the other persons screen after a refresh

Jan 18 '07 #8

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

Similar topics

11
by: Jason | last post by:
Let's say I have an html form with 20 or 30 fields in it. The form submits the fields via POST to a php page which updates a table in a database with the $_POST vars. Which makes more sense? ...
1
by: James | last post by:
Hi, I am currently creating a database which will be stored on a network. Somebody will take this database out on a laptop will they will input new data via a form. Somehow this new version...
2
by: RC | last post by:
I am updating/improving a working database for a non-profit organization. I am thinking of making a copy of the database at the office, bringing the copy to my house, making the changes and then...
1
by: Richard Coutts | last post by:
I have a Continuous Form where each record has a button that activates another form that simplifies entering values into the record. The activated form has the equivalent of a "Done" button. I'd...
2
by: phil03 | last post by:
Hi, I'm looking for some thoughts/guidance about the following scenario. A bit background first.... I have an Access database (BE) which has numerous linked tables connected to our company...
2
by: sara | last post by:
I am not very experienced myself with Access (using A2K) and find myself writing applications for users who have never used a PC. All the samples I've seen use the built-in features of Access -...
4
by: Darrel | last post by:
I'm creating a table that contains multiple records pulled out of the database. I'm building the table myself and passing it to the page since the table needs to be fairly customized (ie, a...
10
by: jaYPee | last post by:
does anyone experienced slowness when updating a dataset using AcceptChanges? when calling this code it takes many seconds to update the database SqlDataAdapter1.Update(DsStudentCourse1)...
5
by: fong.yang | last post by:
I have a database that is being shared on the network. The database it split up into front end and back end. The back end is residing on the shared network drive while the front end is on each...
4
by: rdemyan via AccessMonster.com | last post by:
My application is calculation intensive and the servers are agonizingly slow. Administrators of my application only update the backends once a month (twice a month max). So, my launching program...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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.