Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old October 13th, 2003, 01:27 PM
Authorized User
 
Join Date: Aug 2003
Location: , , .
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Default Maintain entered data

I'm trying to add a new record into a table of a database, and that is no problem, but when it goes to add the new value in the database it clears all the info for the page before that. I was wondering if there might be a way I could submit the record on the same page and reload just the lists, or maybe recall all the info from the previous page (addnewPOP.asp)into the loaded page (addeffort.asp) and just skip the reload to addnew.asp

addnewPOP.asp
...
...
<form method=post action="addeffort.asp" id=form2 name=addneweffort>
<INPUT name=addneweffort ID="Text3" >
<input type=submit value=Add id=submit1 name=submit1>
</form></TD></TR>


addeffort.asp
<%
    Dim objRS, bolFound
    Set objRS = Server.CreateObject ("ADODB.Recordset")
    objRS.Open "Effort", objConn, , 3, 2

%>
<%
bolFound = True
    If (Request.Form("addneweffort") = "")Then
            bolFound = False
            Response.Write "<a href='addnew.asp'>You must enter the data for: Effort.<p></a>"
            End If
    If bolFound = True then
    Set objRS = Server.CreateObject("ADODB.Recordset")
    objRS.Open "effort", objConn, , 3, 2
    objRS.AddNew
    objRS("effort") = Request.Form("addneweffort")
    objRS.Update
objConn.Close
    Set objConn = Nothing
    End If
 Response.Write "<input name=hidform type=hidden value='" & Request.Form("hidform") & "'>"
%>
<script language="javascript">
<!--

location.replace("addnew.asp");

-->
</script>

  #2 (permalink)  
Old October 14th, 2003, 12:00 AM
Authorized User
 
Join Date: Sep 2003
Location: Trivandrum, Kerala, India.
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to balakumar1000
Default

ASP is stateless. You have to manually maintain the state.
So when calling a page to add a record into DB, send all the values from Source page thru Query string or Form Hidden variables to the new page. From the new page send all those Query string or Form Hidden variables back to the source form after db insert is done.


Balakumar V.

  #3 (permalink)  
Old October 14th, 2003, 02:11 AM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

Check out this thread: http://p2p.wrox.com/topic.asp?TOPIC_ID=4999

It describes how to maintain state in a single asp page.

Cheers,

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.


Similar Threads
Thread Thread Starter Forum Replies Last Post
Content Mgmt. System to Maintain XML Data? kwilliams XML 0 May 6th, 2008 09:09 AM
Re: need to convert data entered to all caps flyfish Access 5 March 18th, 2005 12:35 PM
retaining the last data that was entered Calibus Classic ASP Databases 4 October 14th, 2004 03:31 PM
How to check entered data with Validator Control minhpx General .NET 2 September 15th, 2004 04:01 AM
How to check data entered 3 textboxs minhpx General .NET 1 September 13th, 2004 11:46 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.