Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 31st, 2007, 01:47 AM
Authorized User
 
Join Date: Aug 2007
Location: Pune, Maharshtra, India.
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???
Reply With Quote
  #2 (permalink)  
Old August 31st, 2007, 01:49 AM
Authorized User
 
Join Date: Aug 2007
Location: Pune, Maharshtra, India.
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?" :)
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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++ carl.dufresne@sita.aero 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



All times are GMT -4. The time now is 08:57 AM.


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