update multiple rows
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Web Servers reviews > IIS server support > IIS ASP > update multiple rows




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    update multiple rows  
shank


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
08-28-04 08:18 PM

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







[ Post a follow-up to this message ]



    Re: update multiple rows  
Scott


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
08-29-04 01:47 AM

Not sure what programming platform you are using, but you could give
this a read:

http://support.microsoft.com/defaul...r />
2&SD=MSDN





[ Post a follow-up to this message ]



    Re: update multiple rows  
shank


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
08-29-04 07:48 AM

Classic ASP, VBScript, SQL and Dreamweaver.
thanks

"Scott" <scott_e_llewellyn@hotmail.com> wrote in message
news:2f96e5a5.0408281802.7ee0acb1@posting.google.com...
> Not sure what programming platform you are using, but you could give
> this a read:
>
>
http://support.microsoft.com/defaul...r />
2&SD=MSDN







[ Post a follow-up to this message ]



    Re: update multiple rows  
Harag


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
08-29-04 12:48 PM

On Sat, 28 Aug 2004 16:52:36 -0400, "shank" <shank@tampabay.rr.com>
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






[ Post a follow-up to this message ]



    Re: update multiple rows  
shank


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
08-29-04 12:48 PM


"Harag" <haragREMOVETHESECAPITALS@softhome.net> wrote in message
 news:dp73j090ciai1o3ec9an2jap1cki24krf3@
4ax.com...
> On Sat, 28 Aug 2004 16:52:36 -0400, "shank" <shank@tampabay.rr.com>
> wrote:
> 
any[vbcol=seagreen] 
is[vbcol=seagreen] 
>
> 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!







[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 09:52 AM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register