Solved

Passing SQL 7 and user added data over 4 pages

Posted on 2001-06-02
3
179 Views
Last Modified: 2013-12-24
Using UD 4.01

I have 4 pages that gets data from a SQL7 database (passes using a combo box dropdown) and data from user entry (data collected using edit controls).

Since there is so much data that needs to get collected, I divided the collecting data up into four pages. I need to keep the data values alive until it gets to the last page and then it needs to be display in a table grid. This will give the user the ability to review the data prior to submitting it to the datatbase.

How do I keep the data live so it can pass from page to page until I get to the end? Examples, if possible.

DO I use a session variable? If so how do I set then when some of the content is going to be added by the user?

Thanks in advance.

rb
0
Comment
Question by:routerboy309
3 Comments
 
LVL 15

Accepted Solution

by:
ericpete earned 100 total points
ID: 6151009
You create a session variable, using the record number, when you enter the data on the first page. Then, when you go to the second page, you filter the recordset using the session variable.
0
 
LVL 1

Expert Comment

by:dclary
ID: 6238546
Best practices usually include being as sessionless as possible. But Eric Pete has the right answer.

In the pre-html portion of the 2nd page, read in the data from the post or get (whichever you're using) and Inset the SQL record. When you get the record number returned, be sure to set a hidden field its value, so you can retrieve it on subsequent pages.

(I use a stored procedure for the insert, so I can write code that returns the identity for me.

So if the user is  entering new data, page one is:

<%
'regular stuff
%>
<html>
<form with a bunch of fields>
</form>
</html>

Page 2 is

<%
sqlstring = "sp_insert "
sqlstring = sqlstring & request.form("field1") & ", "
sqlstring = sqlstring & request.form("etc") & " "
adors = adocon.openrecordset(sqlstring,0,1)
%>
<html>
<form>
<select type=hidden name=Myid value=<% =adors.fields(0).value %>>
<other form objects, blah blah>
</form>

On page 3... it's easy, you have the record number, so instead of inserting the record, update it:

sqlstring = "update mytable, set field2 = " & request.form("field2") & ", etal = " & request.form("etal") & " where IDField = " & request.form("MyID")
adocon.execute sqlstring

And finally, on page four, when you want to present all the entered data, simply retrieve it via the record number you've continued to pass along.

"Select * from mytable where IDfield = " & request.form("myid")


Hope this helps!
0
 

Author Comment

by:routerboy309
ID: 6238696
Ok - I see - carry the info over to the next and build the SQL statement as you go..

Thanks

RB
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When deciding to adopt any help desk solutions many factors should be explored before taking decisions. This will change from business to another but in general there are some kind of rule of thumb. Here are some quick tips: Do we need only ticket…
Now that Expression Web 4.0 (http://www.microsoft.com/expression/products/Upgrade.aspx) is free if you buy or have the full version of Expression Web 3.0, now is the best time to  migrate from FrontPage to Expression Web (http://www.frontpage-to-exp…
The purpose of this video is to demonstrate how to manually back up a WordPress Database. This will be demonstrated using a Windows 8 PC. The Host used will be IPage.com Log into your Hosting account. IPage will be used for demonstration : Locat…
The purpose of this video is to demonstrate how to exclude a particular blog category from the main blog page. This is can be used when a category already has its own tab, or you simply want certain types of posts not to show up on the main blog. …

827 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question