Print Page | Close Window

Asp question

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=13546
Printed Date: 30 March 2026 at 2:51pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Asp question
Posted By: rleffew
Subject: Asp question
Date Posted: 28 January 2005 at 9:12am
I am new with ASP (mostly do Visual Basic programming).

I am loading a database onto a screen on website.  Simply list the items from the database onto the screen with a button next to each item.  This button is used to take the person to another screen with more detail of the item they selected.

This is how the button works.

<input type="button" onClick="<%=strButton%>" value="Pull Q">

with strbutton being:

strButton = "parent.location='QuoteDetail.asp?QID=" & getID & "'"

This works fine except now I need for QID to actually be a session because I need to come back to the page and I actually loose QID.

I tried this:

strButton= "parent.location='QuoteDetail.asp?Session("SuplQuoteID")=" & getID & "'"

But I received the following error:

<>Microsoft VBScript compilation error '800a0401'
Expected end of statement
/quotelogscreen.asp, line 67

strButton= "parent.location='QuoteDetail.asp?Session("SuplQuoteID")=" & getID & "'"

Any Suggestion?

Thanks,

Bob
------------------------------------------------------^

 but it did not work, gave me an error said looking for





Replies:
Posted By: dj air
Date Posted: 28 January 2005 at 9:17am
this is wrong

strButton= "parent.location='QuoteDetail.asp?Session("SuplQuoteID")=" & getID & "'"


you need to use " & Session("SuplQuoteID") &"=" & getID & "
if you are not setting it in a veriable ie strButton = 

thats into a veriable

but if you wanted to show the value use <%=getID %>


Posted By: rleffew
Date Posted: 28 January 2005 at 10:20am
I am confused on what you meant about the variable.

I think I what you said.  I changed my command to the following and received this message:

Microsoft VBScript compilation error '800a0401'

Expected end of statement

/quotelogscreen.asp, line 67

strButton= "parent.location='QuoteDetail.asp?& Session("SuplQuoteID") &"=" & getID & "



Posted By: dj air
Date Posted: 28 January 2005 at 11:02am
it needs to be


strButton= "parent.location='QuoteDetail.asp?" & Session("SuplQuoteID") &"=" & getID & "'"
red section has to be there


Posted By: rleffew
Date Posted: 28 January 2005 at 11:08am
The syntax was correct this time.  Problem was the page going to did not recognize the session variable.

This is page i am working on

http://www.cejco.net/quotelogscreen.asp


Posted By: dj air
Date Posted: 28 January 2005 at 11:26am
what is te session ment to hold is it working ok now?


Posted By: rleffew
Date Posted: 28 January 2005 at 11:43am
The page is www.cejco.net/quotelogscreen.asp if you want to look at it and click on one of the buttons to the left of the screen.

I hope I can explain what I am trying to do better. Here goes.

I have an array of data that I list on a page.
This data comes from a ADO Access database.

This data is listed on the page with a button next to each item.

I simply want to click on lets say the 5th item listed on the screen.  This has a separate Supplier Quote ID that distringuishes it from the other items on the list.

I want to go to another page and list out more detail of that quote.

So depending on what button is clicked I need to capture in a session
variable Session("SuplQuoteID")  the Supplier Quote ID for that line item and go to QuoteDetail.asp which obviously will use the session variable to populate the page.



Posted By: dj air
Date Posted: 28 January 2005 at 1:27pm
now i under stand ... to set a session you don't set it like the above.. (tell me if im wrong about what im suggesting)

to set a session veriable you use

session("sessionname") = value

the above that you have done is incorrect. i tink you want to send the Quote ID through the querystring

to do so

change the section for the url to the below.


strButton= "parent.location='QuoteDetail.asp?QuoteID=" & getID & "'"

then on rgw quotedetail.asp page

bring in the Quote ID like the below

strQuoteID = Request.querystring("QuoteID")

now when you query the database use the value strQuoteID .




Posted By: rleffew
Date Posted: 28 January 2005 at 2:06pm
That is how I had it before.  It works that way. The problem is when I go the Quote Detail page (quotedetail.asp) I have on that page a form for them to fill out any notes for that quote and update it to a database.  All this worked fine. 

I use the form submit button which takes you to a page (QuoteNoteAdd.asp) that does the actual database addition of the note. 

From that page when I go back to the QuoteDetail page I loose the quereystring.  Is there a way to reset the query string in QuoteAddNote.asp so I can get back into qoutedetail.asp.  This is why I thought of using session.


Posted By: dj air
Date Posted: 28 January 2005 at 3:25pm
to get the querystring value just use request.querystring("stringName")..

if the value is / sent though the string it will be able to be collected


Posted By: rleffew
Date Posted: 28 January 2005 at 3:34pm
Thanks that did it.  I appreciate it very much.  Do you know how to populate a  form text box  after reading  a datebase.

Last think  I need to know.  You have been very helpful.

Thanks again.


Posted By: dj air
Date Posted: 28 January 2005 at 4:27pm
one way is to set a veriable with the value

like strdatabasevalue = connection("table filed name")

connection is the same as the one stated on the .open line


then use <%= strdatabasevale %. to show the database value


Posted By: rleffew
Date Posted: 28 January 2005 at 4:46pm
I have a form called form1 with 2 textboxes.

I do the following code:

    DBPath = Server.MapPath("/database/cejco.mdb")
   
    Set MyConn = Server.CreateObject("ADODB.Connection")
    Set MyNS = Server.CreateObject("ADODB.Recordset")
    MyConn.Open "Driver={Microsoft Access Driver (*.mdb)};DBQ=" & DBPath 
    SQL = "SELECT * From QuoteDailyNote Where QuoteDailyAuto = " & quoteAutoID
    'open main rs for populating participant page
    MyNS.Open SQL, MyConn, adOpenKeySet, adLockPessimistic, adCmdText   

If MyNs.Recordcount > 0 Then
   
    MyNS.MoveFirst
    Do While Not MyNS.EOF
        Session("QuoDlyAutoID") = quoteAutoID
        x = MyNS.Fields("QuoteDailyHeader")
        document.form1.txtNoteDB.value = myNS.Fields("QuoteDailyNote")

I am assuming the last line (document.form...) is incorrect.
I am not sure what you were saying.

Thanks,

Bob

%>


Posted By: Gullanian
Date Posted: 06 February 2005 at 9:21pm
You can't do it like that unfortunatly.  Put the value you want to load into the textbox in a variable like:

strValueFromDB = myNS.Fields("QuoteDailyNote")

Then go to where the textbox (or whatever) is and put:

<input type="text" value="<%=strValueFromDB %>">



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net