Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 MS Access
 Multiple Records displayed in ASP but want to update a single field from a single record.

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-06-25 : 08:26:09
Jon writes "On Windows 2000 Pro running IIS 5.0 I am trying to create a simple ASP helpdesk with an Access Database backend. The screen containing the main issue is on a History.asp. It shows all of the records on this screen. One of the fields of each record is a drop-down that has a list of users with a Save Changes, submit button next to it. The problem occurs when I try to update the database with another ASP. Since more than one record exists on history.asp it passes the information for every record with the same variable. How best should I design this to best empower the history screen to update this single field for a single record. Your assistance is greatly appreciated."

rrb
SQLTeam Poet Laureate

1479 Posts

Posted - 2002-06-26 : 19:37:09
Hi Jon

I'm assuming each record has a unique ID? Do you have one save changes button for all the records, or a button next to each?

--
I hope that when I die someone will say of me "That guy sure owed me a lot of money"
Go to Top of Page

MichaelP
Jedi Yak

2489 Posts

Posted - 2002-06-26 : 19:44:58
well you could do this. In the onChange event of the <Select>, have a javascript function that does a form.submit.

You'll need to have each row be it's own <form>.

so you'll wind up with something like this

<select name="lstUsers" size="1" onChange="this.form.submit();"">

The DOWN side to doing this is that EVERY time they change that select box, it will do an UPDATE in the database. If you want to allow them to change multiple records, and then save those changes all at once, I am available for consulting :)

Michael

--------------------
<Yoda>Use the Search page you must.
Go to Top of Page

rrb
SQLTeam Poet Laureate

1479 Posts

Posted - 2002-06-26 : 19:47:13
alternately, you could just create an array and store in it the ID's of the fields you want to update at the end. Using the "onchange" event to add the id to the array...etc

--
I hope that when I die someone will say of me "That guy sure owed me a lot of money"
Go to Top of Page

MichaelP
Jedi Yak

2489 Posts

Posted - 2002-06-26 : 22:55:51
RRB exactly.

What I usually do is build up a delimited string using client-side javascript, and then parse it apart and update my database with the individual updates it contains.

Fairly easy, and fairly fast, and pretty fast on the user end since they don't have a server round trip after each change.

Michael

--------------------
<Yoda>Use the Search page you must.
Go to Top of Page
   

- Advertisement -