Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access_asp thread: Option to Add or Change Record in Program


Message #1 by "Stephen Proctor" <steveproctor@c...> on Sun, 21 Oct 2001 04:55:00
I am writing a program to update a personnel database.  I've already done 

separate programs (that work) that take information from separate html 

forms (for example add.htm triggers add.asp; change.htm triggers 

change.asp)



I would like to have one html form in which the user inputs initials (for 

a name) then selects a change or add option button.  Based on the choice 

the add.asp or change.asp would be called.



What is a good way for this?  Can I use Select Case?  This is like 

Appendix F in Beginning ASP.  But how can a case trigger an asp program?  

Also can I use asp in the form itself or do I need the form to call asp?



Alternatively, should I use subroutines so that add.asp and change.asp are 

consolidated into one program?  Any other suggestions?



Steve
Message #2 by "Tony DiNucci" <tonydinucci@h...> on Tue, 23 Oct 2001 01:22:49
Firstly you can use asp in a form page.  Typically when i implement an 

update page (like the one you speak of) I include the origional data in 

the form fileds so the user only has to edit the fields they wish to.  

just set a recordset and do as you would to print the data to the screen 

but in the form fields, for eg:



<tr> 

 <td>Name</td>

 <td> 

  <input type="text" name="name" size="30" maxlength="100"           

value="<%=userRS("name")%>">

 </td>

</tr>

  

as for the two buttons (add or change), the way I usually go about doing 

this is to make one of the buttons a graphic, that looks identical to a 

html button that also has a downState-onMouseDown (just do a couple of 

screen dumps and use a graphics package), include a queryString in its URL 

and this works perfecly. 



your question on using a case statement is quite interesting, and to be 

honest i dont know the answer, i dont know if there is a way or not to do 

this using a single form as the form decides the page to go to ,not the 

buttons.  but if you can get the recieving page to recognise the button 

that was clicked a Case or If statement will work. 

Hope this is of help







> I am writing a program to update a personnel database.  I've already 

done 

> separate programs (that work) that take information from separate html 

> forms (for example add.htm triggers add.asp; change.htm triggers 

> change.asp)

> 

> I would like to have one html form in which the user inputs initials 

(for 

> a name) then selects a change or add option button.  Based on the choice 

> the add.asp or change.asp would be called.

> 

> What is a good way for this?  Can I use Select Case?  This is like 

> Appendix F in Beginning ASP.  But how can a case trigger an asp 

program?  

> Also can I use asp in the form itself or do I need the form to call asp?

> 

> Alternatively, should I use subroutines so that add.asp and change.asp 

are 

> consolidated into one program?  Any other suggestions?

> 

> Steve
Message #3 by "Charles Mabbott" <aa8vs@m...> on Wed, 24 Oct 2001 06:23:21 -0400
I have done a similar item based on selections from input

screen, be happy to forward .asp page when I get back to

states from far east......  At least it may give you some

other ideas, if you get solution sooner great.  I will be

flying back this weekend.



Chuck





"Do not meddle in the affairs

of Dragons?. Cuz like you

is crunchy and taste good

with catsup."

- Unknown



http://aa8vs.dhs.org:81/aa8vs







>From: "Stephen Proctor" <steveproctor@c...>

>Reply-To: "Access ASP" <access_asp@p...>

>To: "Access ASP" <access_asp@p...>

>Subject: [access_asp] Option to Add or Change Record in Program

>Date: Sun, 21 Oct 2001 04:55:00

>

>I am writing a program to update a personnel database.  I've already done

>separate programs (that work) that take information from separate html

>forms (for example add.htm triggers add.asp; change.htm triggers

>change.asp)

>

>I would like to have one html form in which the user inputs initials (for

>a name) then selects a change or add option button.  Based on the choice

>the add.asp or change.asp would be called.

>

>What is a good way for this?  Can I use Select Case?  This is like

>Appendix F in Beginning ASP.  But how can a case trigger an asp program?

>Also can I use asp in the form itself or do I need the form to call asp?

>

>Alternatively, should I use subroutines so that add.asp and change.asp are

>consolidated into one program?  Any other suggestions?

>

>Steve
Message #4 by "Charles Mabbott" <aa8vs@m...> on Sat, 27 Oct 2001 10:27:49 -0400
Maybe this will help, here is a page where I used CASE type statement:



<%

Option Explicit

Dim strConnect

%>

<!-- #include file="DataStore11.asp" -->

<!-- METADATA TYPE="typelib"

FILE="C:\Program Files\Common Files\System\ado\msado15.dll" -->

<HTML>

<HEAD>

<TITLE>Delete record by Call Sign</TITLE>

</HEAD>

<BODY>

<center>

<h1>Updating member information <br>

record with following information</h1>

<h3>Joe's Maintenance Page</h3>

</center>

<%

Dim objRS, objComm, intNoOfRecords, strcall, strclass, strdate

Dim icase

icase = 0

strclass = request.form("drop")

if (len(strclass) > 0 ) then

icase = icase + 1

end if

strdate = request.form("sRn")

if (len(strdate) > 0 ) then

icase = icase + 2

end if

strcall =3D UCase(request.form("scl") )

if (len(strcall) < 1 ) then

icase = 0

end if

Set objComm = Server.CreateObject("ADODB.Command")

objComm.ActiveConnection = strConnect

response.write "The following Callsign: " & strcall & " will be updated <

br>" & _

"with the following information;"

Select Case icase

Case 1 ' update license class

response.write "<p> Class: " & strclass & " <br>"

objComm.CommandText = "UPDATE Members SET class = ' " & strclass & " 

' WHERE ( CallID = '" &strcall & "' ) "

objComm.commandtype=adcmdtext

objComm.execute intNoOfRecords

Case 2 ' update the renewal date

response.write "<p> Renew: " & strdate & " <br>"

objComm.CommandText = "UPDATE Members SET renew = ' " & strdate & " '

 WHERE ( CallID = '" & strcall & "' ) "

objComm.commandtype=adcmdtext

objComm.execute intNoOfRecords

Case 3 ' update the license class

response.write "<p> Class: " & strclass & " Renew: " & strdate & "<br>"

objComm.CommandText = "UPDATE Members SET class = ' " & strclass & "

' WHERE ( CallID = '" &strcall & "' ) "

objComm.commandtype=adcmdtext 

objComm.execute intNoOfRecords

' now do the renewal date

objComm.CommandText = "UPDATE Members SET renew = ' " & strdate & " '

 WHERE ( CallID = '" & strcall & "' ) "

objComm.commandtype=adcmdtext

objComm.execute intNoOfRecords

Case 0

response.write "<h2> Missing data please review input page<br> Call sign 

is mandatory </h2> "

End Select

%>

<center>

<a href="newaddi94.asp#top">Enter</a> page<br>

<a href="upkeep.asp#top">Maintence</a> page

</center>

<h3>Last update: 9/12/01</h3>

</BODY>

</HTML>





----- Original Message -----

From: Stephen Proctor

Sent: Sunday, October 21, 2001 6:06 AM

To: Access ASP

Subject: [access_asp] Option to Add or Change Record in Program



I am writing a program to update a personnel database.  I've already done

separate programs (that work) that take information from separate html

forms (for example add.htm triggers add.asp; change.htm triggers

change.asp)



I would like to have one html form in which the user inputs initials (for

a name) then selects a change or add option button.  Based on the choice

the add.asp or change.asp would be called.



What is a good way for this?  Can I use Select Case?  This is like

Appendix F in Beginning ASP.  But how can a case trigger an asp program?

Also can I use asp in the form itself or do I need the form to call asp?



Alternatively, should I use subroutines so that add.asp and change.asp ar

e

consolidated into one program?  Any other suggestions?



Steve

  Return to Index