By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,857 Members | 1,793 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,857 IT Pros & Developers. It's quick & easy.

Detecting Changes to a dataform question

P: n/a
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.

Nov 19 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a

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: ne***********@gmail.com
| 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: <11*********************@g49g2000cwa.googlegroups. com>
| 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: gr**********@google.com
| 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: gr**********@google.com
| Injection-Info: g49g2000cwa.googlegroups.com;
posting-host=216.235.146.236;
| posting-account=4x5ohgsAAACg5EznArV1kEPHmTNHqHa7
| Path:
TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfee d00.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.
|
|

Nov 19 '05 #2

P: n/a
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)


<ne***********@gmail.com> wrote in message
news:11*********************@g49g2000cwa.googlegro ups.com...
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.

Nov 19 '05 #3

P: n/a
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.

Nov 19 '05 #4

P: n/a
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.

Nov 19 '05 #5

P: n/a

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: ne***********@gmail.com
| 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: <11*********************@z14g2000cwz.googlegroups. com>
| References: <11*********************@g49g2000cwa.googlegroups. com>
| <uT**************@TK2MSFTNGP11.phx.gbl>
| 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: gr**********@google.com
| NNTP-Posting-Date: Mon, 26 Sep 2005 22:01:38 +0000 (UTC)
| In-Reply-To: <uT**************@TK2MSFTNGP11.phx.gbl>
| 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: gr**********@google.com
| Injection-Info: z14g2000cwz.googlegroups.com;
posting-host=216.235.146.236;
| posting-account=4x5ohgsAAACg5EznArV1kEPHmTNHqHa7
| Path:
TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfee d00.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.
|
|

Nov 19 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.