Detecting Changes to a dataform question

N

needin4mation

Hi, I have an asp.net 1.1 application that populates data from a
database. When the user changes data, they have to hit a button to
update the data. The data entry form (same form that is populated) is
from several different tables. To the user, of course, this is not
seen.

Scenario: After the page is populated, assume a change is made to the
form and the user hits update. The page then goes back, reads the
database for that record and then compares the results to what the user
typed in. If it is the same, it goes to the next set of controls to
check. If it is diffent, it does an update mytable set to the
database.

Example: An address:

The populate form has 123 Main St. MyTown, CA. 999999

The user changes this to 124 Main St. Dallas, Tx. 4444477

The user hits update. The database reads the database. It gathers
values. It compares the values to what the user submitted just now and
if there are changes, it updates that row. If not it leaves it.

My question is is this the wrong way to do it? It "feels" wrong.
Thanks.
 
M

Mohamed Sharaf

Hi,
Why all this, just update the all tables with the new data whether it's
the same or it's new. Is there any business need for what you are doing?

Best regards,
Mohamed Sharaf
MEA Developer Support Center
ITWorx on behalf Microsoft EMEA GTSC
--------------------
| From: (e-mail address removed)
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| Subject: Detecting Changes to a dataform question
| Date: 26 Sep 2005 07:55:47 -0700
| Organization: http://groups.google.com
| Lines: 26
| Message-ID: <[email protected]>
| NNTP-Posting-Host: 216.235.146.236
| Mime-Version: 1.0
| Content-Type: text/plain; charset="iso-8859-1"
| X-Trace: posting.google.com 1127746552 23076 127.0.0.1 (26 Sep 2005
14:55:52 GMT)
| X-Complaints-To: (e-mail address removed)
| NNTP-Posting-Date: Mon, 26 Sep 2005 14:55:52 +0000 (UTC)
| User-Agent: G2/0.2
| X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1;
..NET CLR 1.1.4322),gzip(gfe),gzip(gfe)
| Complaints-To: (e-mail address removed)
| Injection-Info: g49g2000cwa.googlegroups.com;
posting-host=216.235.146.236;
| posting-account=4x5ohgsAAACg5EznArV1kEPHmTNHqHa7
| Path:
TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.sul.t-online.de!t-onli
ne.de!border2.nntp.dca.giganews.com!nntp.giganews.com!postnews.google.com!g4
9g2000cwa.googlegroups.com!not-for-mail
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.aspnet:127056
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| Hi, I have an asp.net 1.1 application that populates data from a
| database. When the user changes data, they have to hit a button to
| update the data. The data entry form (same form that is populated) is
| from several different tables. To the user, of course, this is not
| seen.
|
| Scenario: After the page is populated, assume a change is made to the
| form and the user hits update. The page then goes back, reads the
| database for that record and then compares the results to what the user
| typed in. If it is the same, it goes to the next set of controls to
| check. If it is diffent, it does an update mytable set to the
| database.
|
| Example: An address:
|
| The populate form has 123 Main St. MyTown, CA. 999999
|
| The user changes this to 124 Main St. Dallas, Tx. 4444477
|
| The user hits update. The database reads the database. It gathers
| values. It compares the values to what the user submitted just now and
| if there are changes, it updates that row. If not it leaves it.
|
| My question is is this the wrong way to do it? It "feels" wrong.
| Thanks.
|
|
 
B

Bruce Barker

normally you keep the old values, and check that they still match (someone
else hasn't changed the record). this means it better to detect user changes
independant of the database. datasets are common for this.

-- bruce (sqlwork.com)
 
N

needin4mation

Yes, becaause I keep a history of the previous information.

So, say they update an address. If the user changes the address, I
keep a row of the old one and insert a new one. I made mistake above
when I said update set. That actually referred to my table that held
the most current id of the address, so I know the most recent.

This is why I have to know if it changes. If it does I insert a new
row, if it does not, then I leave it alone.
 
N

needin4mation

I'm sorry to be dense on this, but do you have an example link where I
would be able to see this in action? I'm still thinking classic asp I
think and need guidance. Thank you.
 
M

Mohamed Sharaf

Hi,
I think the best solution for the performance is to change the update
Stored Procedure or TSQL text to do this task on the database side. No
matter you are using a data adapter or data reader, at the end of the day
you will call a stored procedure to update the data. In this stored do the
comparison and do whatever the backup you want.

HTH
Mohamed Sharaf
MEA Developer Support Center
ITWorx on behalf Microsoft EMEA GTSC
--------------------
| From: (e-mail address removed)
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| Subject: Re: Detecting Changes to a dataform question
| Date: 26 Sep 2005 15:01:31 -0700
| Organization: http://groups.google.com
| Lines: 4
| Message-ID: <[email protected]>
| References: <[email protected]>
| <uTK#[email protected]>
| NNTP-Posting-Host: 216.235.146.236
| Mime-Version: 1.0
| Content-Type: text/plain; charset="iso-8859-1"
| X-Trace: posting.google.com 1127772098 26392 127.0.0.1 (26 Sep 2005
22:01:38 GMT)
| X-Complaints-To: (e-mail address removed)
| NNTP-Posting-Date: Mon, 26 Sep 2005 22:01:38 +0000 (UTC)
| In-Reply-To: <uTK#[email protected]>
| User-Agent: G2/0.2
| X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1;
.NET CLR 1.1.4322),gzip(gfe),gzip(gfe)
| Complaints-To: (e-mail address removed)
| Injection-Info: z14g2000cwz.googlegroups.com;
posting-host=216.235.146.236;
| posting-account=4x5ohgsAAACg5EznArV1kEPHmTNHqHa7
| Path:
TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.sul.t-online.de!t-onli
ne.de!border2.nntp.dca.giganews.com!nntp.giganews.com!postnews.google.com!z1
4g2000cwz.googlegroups.com!not-for-mail
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.aspnet:127243
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| I'm sorry to be dense on this, but do you have an example link where I
| would be able to see this in action? I'm still thinking classic asp I
| think and need guidance. Thank you.
|
|
 

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

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top