Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > update multiple rows

Reply
Thread Tools

update multiple rows

 
 
shank
Guest
Posts: n/a
 
      08-28-2004
Visually, the page will look somewhat like a spreadsheet. It could have
hundreds of records (rows) displayed. I want to enable the user to edit any
one or any number of records and any fields, then click a save button to
UPDATE the SQL table. I'd like to use stored procedures if possible. How is
this done? Where do I start?

thanks


 
Reply With Quote
 
 
 
 
Scott
Guest
Posts: n/a
 
      08-29-2004
Not sure what programming platform you are using, but you could give
this a read:

http://support.microsoft.com/default...229672&SD=MSDN
 
Reply With Quote
 
 
 
 
shank
Guest
Posts: n/a
 
      08-29-2004
Classic ASP, VBScript, SQL and Dreamweaver.
thanks

"Scott" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) om...
> Not sure what programming platform you are using, but you could give
> this a read:
>
>

http://support.microsoft.com/default...229672&SD=MSDN


 
Reply With Quote
 
Harag
Guest
Posts: n/a
 
      08-29-2004
On Sat, 28 Aug 2004 16:52:36 -0400, "shank" <(E-Mail Removed)>
wrote:

>Visually, the page will look somewhat like a spreadsheet. It could have
>hundreds of records (rows) displayed. I want to enable the user to edit any
>one or any number of records and any fields, then click a save button to
>UPDATE the SQL table. I'd like to use stored procedures if possible. How is
>this done? Where do I start?
>
>thanks
>


Firstly you need to think about the front end a bit more and who are
the users that will be using it imho (lan, intranet, just you, couple
admin people or the millions on the web?)

Look at not displaying 100's of rows but only 10-30 or so at a time
for this you would need some sort of paging stored proc.

http://www.aspfaq.com/2120

check out the last version listed using @@rowcount by Chris Hohmann
for this.


Also saving the info... will it be one save button at the bottom? or
one for each row ?

eg

<form ...>
line 1 ID: <input type="hidden" name="memID" value="1234">
line 1 name: <input type="text" name="memName" value="fred
flintstone">
line 1 age: <input type="text" name="memAge" value="32">

line 2 ID: <input type="hidden" name="memID" value="1235">
line 2 name: <input type="text" name="memName" value="Wilma
flintstone">
line 2 age: <input type="text" name="memAge" value="28">

line 3 ID: <input type="hidden" name="memID" value="1236">
line 3 name: <input type="text" name="memName" value="dino
flintstone">
line 3 age: <input type="text" name="memAge" value="4">

<input type="submit" value="save all">
</form>

by doing the above all the above info will be sent to the server in 3
"arrays"

response.form("memID") would be "1234, 1235, 1236"
response.form("memName") "fred flintstone, wilma flintstone, dino ..."
response.form("memAge") "32, 28, 4"

which you can then send to the DB stored proc and get that to update
the info. Since SQL servers dont have arrays as such then you would
need to check out the following page:

http://www.sommarskog.se/arrays-in-sql.html



If you have a save button for each entry.

<form ...>
line 1 ID: <input type="hidden" name="memID" value="1234">
line 1 name: <input type="text" name="memName" value="fred
flintstone">
line 1 age: <input type="text" name="memAge" value="32">
<input type="submit" value="save">
</form>
<form ...>
line 2 ID: <input type="hidden" name="memID" value="1235">
line 2 name: <input type="text" name="memName" value="Wilma
flintstone">
line 2 age: <input type="text" name="memAge" value="28">
<input type="submit" value="save">
</form>
<form ...>
line 3 ID: <input type="hidden" name="memID" value="1236">
line 3 name: <input type="text" name="memName" value="dino
flintstone">
line 3 age: <input type="text" name="memAge" value="4">
<input type="submit" value="save">
</form>


Then the user will have to click it for each line he has changed. and
one line of info will be sent to the DB and updated, accordingly.


Next - the result... where to send the "save" result. well. since it
has to go to the server to send the info and to update the db, how are
you going to tell the user this has worked ok. Personally when I do
forms I (near) always put the DB updating code in the same for as the
displaying code. so the code for the above would look like this:


FILENAME.ASP.


1) check to see if a form has been posted to this file.
2) if not 1 skil step 3
3a) if 1 then run function "updateDB()" or whatever.
3b) if 2 ok tell user "info saved" or store in variable for later
display

4) get page data(ie the 20 rows to display)
5) display page info to user.
6) EOF.



Other things to think about on the frontend, is what javascript you
might want to make it easier for the user. eg. how about disabling the
save button and only enable it when the user actually changes some
text? or if your doing a SaveALL then you could have another hidden
entry like the MemID which is just 1 or a 0 and set it to 1 when the
user has changed any info, then in the DB stored proc you only need to
update the rows where this value is a 1.


good luck.

HTH.

Al

 
Reply With Quote
 
shank
Guest
Posts: n/a
 
      08-29-2004

"Harag" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> On Sat, 28 Aug 2004 16:52:36 -0400, "shank" <(E-Mail Removed)>
> wrote:
>
> >Visually, the page will look somewhat like a spreadsheet. It could have
> >hundreds of records (rows) displayed. I want to enable the user to edit

any
> >one or any number of records and any fields, then click a save button to
> >UPDATE the SQL table. I'd like to use stored procedures if possible. How

is
> >this done? Where do I start?
> >
> >thanks
> >

>
> Firstly you need to think about the front end a bit more and who are
> the users that will be using it imho (lan, intranet, just you, couple
> admin people or the millions on the web?)
>
> Look at not displaying 100's of rows but only 10-30 or so at a time
> for this you would need some sort of paging stored proc.
>
> http://www.aspfaq.com/2120
>
> check out the last version listed using @@rowcount by Chris Hohmann
> for this.
>
>
> Also saving the info... will it be one save button at the bottom? or
> one for each row ?
>
> eg
>
> <form ...>
> line 1 ID: <input type="hidden" name="memID" value="1234">
> line 1 name: <input type="text" name="memName" value="fred
> flintstone">
> line 1 age: <input type="text" name="memAge" value="32">
>
> line 2 ID: <input type="hidden" name="memID" value="1235">
> line 2 name: <input type="text" name="memName" value="Wilma
> flintstone">
> line 2 age: <input type="text" name="memAge" value="28">
>
> line 3 ID: <input type="hidden" name="memID" value="1236">
> line 3 name: <input type="text" name="memName" value="dino
> flintstone">
> line 3 age: <input type="text" name="memAge" value="4">
>
> <input type="submit" value="save all">
> </form>
>
> by doing the above all the above info will be sent to the server in 3
> "arrays"
>
> response.form("memID") would be "1234, 1235, 1236"
> response.form("memName") "fred flintstone, wilma flintstone, dino ..."
> response.form("memAge") "32, 28, 4"
>
> which you can then send to the DB stored proc and get that to update
> the info. Since SQL servers dont have arrays as such then you would
> need to check out the following page:
>
> http://www.sommarskog.se/arrays-in-sql.html
>
>
>
> If you have a save button for each entry.
>
> <form ...>
> line 1 ID: <input type="hidden" name="memID" value="1234">
> line 1 name: <input type="text" name="memName" value="fred
> flintstone">
> line 1 age: <input type="text" name="memAge" value="32">
> <input type="submit" value="save">
> </form>
> <form ...>
> line 2 ID: <input type="hidden" name="memID" value="1235">
> line 2 name: <input type="text" name="memName" value="Wilma
> flintstone">
> line 2 age: <input type="text" name="memAge" value="28">
> <input type="submit" value="save">
> </form>
> <form ...>
> line 3 ID: <input type="hidden" name="memID" value="1236">
> line 3 name: <input type="text" name="memName" value="dino
> flintstone">
> line 3 age: <input type="text" name="memAge" value="4">
> <input type="submit" value="save">
> </form>
>
>
> Then the user will have to click it for each line he has changed. and
> one line of info will be sent to the DB and updated, accordingly.
>
>
> Next - the result... where to send the "save" result. well. since it
> has to go to the server to send the info and to update the db, how are
> you going to tell the user this has worked ok. Personally when I do
> forms I (near) always put the DB updating code in the same for as the
> displaying code. so the code for the above would look like this:
>
>
> FILENAME.ASP.
>
>
> 1) check to see if a form has been posted to this file.
> 2) if not 1 skil step 3
> 3a) if 1 then run function "updateDB()" or whatever.
> 3b) if 2 ok tell user "info saved" or store in variable for later
> display
>
> 4) get page data(ie the 20 rows to display)
> 5) display page info to user.
> 6) EOF.
>
>
>
> Other things to think about on the frontend, is what javascript you
> might want to make it easier for the user. eg. how about disabling the
> save button and only enable it when the user actually changes some
> text? or if your doing a SaveALL then you could have another hidden
> entry like the MemID which is just 1 or a 0 and set it to 1 when the
> user has changed any info, then in the DB stored proc you only need to
> update the rows where this value is a 1.
>
>
> good luck.
>
> HTH.
>
> Al
>

-----------------------
There will only be about 6 users who can access the page. I was planning on
one save button. But after considering all the possibilities, I think it's
best if I just let them connect with ODBC and use Access as a frontend on
everyone's desktop. The end effort is to enable these 6 people to edit one
single table of data without downloading and passing it around the country
for everyone's edits. Also, they will need the capability of running
reports. Access will be easiest to handle this.

I still want to try the above though. Your suggestions will help on other
projects.
thanks!


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Update Multiple Datagrid Rows Erik Lautier ASP .Net 1 04-08-2008 09:50 PM
1 global update button to update all rows in Gridview mesut ASP .Net 0 02-19-2007 02:00 PM
unable to update multiple rows with sql query or trigger(URGENT) sanju ASP .Net 0 12-18-2006 09:18 AM
Web Page to Update Multiple Rows from Grid Ram ASP .Net Web Controls 0 07-09-2006 06:45 AM
Update Multiple Rows in GridView Memi ASP .Net Web Controls 0 05-19-2005 10:47 PM



Advertisments