Wrox Programmer Forums
|
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
 
Old August 31st, 2007, 01:47 AM
Authorized User
 
Join Date: Aug 2007
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Default Using Session...hot to do that?

My application wants user to register himself on first page and then it transfers it to second page wherein he has to fill-up employee information.So,I've written this code to generate company-id which wud then be assigned to that particular company like this--

strSQL="SELECT MAX(CompanyId)+1 as maxval FROM MASTER"
    Set objRs=objConn.execute(strSQL)
    CompanyId=objRs("maxval")
    response.write "company-id=" &CompanyId

    If IsNull(CompanyId) then
    CompanyId = 1
    End If

    'SET VARIABLES FROM FORM
    company_name=request.form("cname")
    company_location=request.form("clocation")
    company_function=request.form("cfunction")
    company_core_bsns=request.form("ccbsns")
    company_ceo=request.form("cceo")


I am taking values of the other variables from html code written above to this asp code.

after the insert query I am redirecting the user to next page named emp_info1.asp this way--

response.redirect "emp_info1.asp"

On emp_info1.asp , m tryin to generate employee-id by using same sql query I used for generating Company-id.It is working fine.But now the problem is that I want to insert this employee-id along with other details and Company-id too , in the employee table.I am using this query for generating employee-id ---

strSQL="SELECT MAX(EmpId)+1 as maxval FROM EMPLOYEE WHERE CompanyId='" & str & "'"
    Set objRs=objConn.execute(strSQL)
    EmpId=objRs("maxval")

Now the problem is that I've tried every possible method to get the value of company-id from previous page.But the value of company-id that is being inserted in database each time is 0.This means form is not getting value for company-id from previous page.I tried both form methods- get and post. I also tried session's concept. But nothing seems to be working. I think session concept wud be gud because it wud be helpful in implementing checks on further pages of my website.But m not so clear with it.

What I did to implement session's concept is that I wrote this stmt in global.asa--

Sub Session_OnStart()
    session("id")=CompanyId
End Sub

Sub Session_OnEnd()

End Sub

then on first page where I want user to get registered, I assigned company-id generated in session variable like this--

session("id")=request.form("cid")

and on second page where I am retrieving company-id from previous page, I wrote--

str=session("id")

But even after all this, m unable to get company-id value in str from previous page.

What shud I do now??? Can anyone help???
 
Old August 31st, 2007, 01:49 AM
Authorized User
 
Join Date: Aug 2007
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Sorry,I made a typo...the topic was "Using Session...how to do that?" :)





Similar Threads
Thread Thread Starter Forum Replies Last Post
Hot-Linking back to the same document ... asearle XSLT 4 November 15th, 2006 03:43 AM
Hot Spots - Pop up text 69liz Dreamweaver (all versions) 2 February 14th, 2006 12:43 AM
hot keys in C++ [email protected] C++ Programming 3 January 5th, 2006 02:28 AM
Hot Keys Louisa VB.NET 2002/2003 Basics 6 September 27th, 2004 09:48 AM
Hot Fixes to Patches Walden SQL Server 2000 2 September 16th, 2003 12:48 PM





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