473,395 Members | 1,846 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

How i can create Seasson variable (ASP) through VBscript

It is possible create Seasson variable (ASP) through VBscript?
Apr 2 '10 #1
5 8062
GazMathias
228 Expert 128KB
It is done like:
Expand|Select|Wrap|Line Numbers
  1. <%
  2. session("variable") = "value"
  3. %>
  4.  
The Session Object

Gaz
Apr 3 '10 #2
i dont mean that i want to get a vbscript variable into Session variable in vb script

like that

<script type=text/vbscript>
dim n
n = 3
<%Session("variable") = %> & n
</script>

i want to do somthing like that but its not working
Apr 3 '10 #3
GazMathias
228 Expert 128KB
i want to do somthing like that but its not working
Of course it isn't.

Code between <% and %> is executed at the server and the <script type = text/vbscript> is executed at the browser (IE engine browsers only to my knowledge).

You therefore have to post the value you want to store in session back to the server using Post or Get and then assign it like I illustrated above.

Gaz
Apr 3 '10 #4
look what i wrote :
Expand|Select|Wrap|Line Numbers
  1. <%
  2. Dim n
  3. n = 1
  4. %>
  5. <html>
  6. <head>
  7. <script type="text/vbscript" language="VBScript"  >
  8.     Sub buy(obj)
  9.  
  10.  
  11. <%
  12. Session("productID") = %>&obj.name
  13. Msgbox "<%=Session("productID")%>"
  14.  
  15.  
  16. end sub
  17.          </script>
  18.  
  19. </head>
  20. <body dir="center">
  21. <%
  22. path = Server.mappath("../db/ServerData.mdb")
  23. set con = Server.createobject("ADODB.Connection")
  24. con.open "driver={Microsoft Access Driver (*.mdb)};DBQ="&path
  25. set r = con.execute("select * from products")
  26. response.write "<form method='post'  >"
  27. response.write "<table border='0' width='100%' cellspacing='50px'>"
  28. response.write "<tr>"
  29. response.write "<th>Number</th>"
  30. response.write "<th>Name</th>"
  31. response.write "<th>Picture</th>"
  32. response.write "<th>Description</th>"
  33. response.write "<th>Price</th>"
  34. response.write "<th>Quanty</th>"
  35. response.write "<th>Order</th>"
  36. response.write "</tr>"
  37. do until r.eof
  38. response.write "<tr>"
  39. response.write "<td>"&r.fields("ItemID")&"</td>"
  40. response.write "<td>"&r.fields("Name")&"</td>"
  41. response.write "<td><img src='"&r.fields("Picture")&"'></td>"
  42. response.write "<td>"&r.fields("Description")&"</td>"
  43. response.write "<td>"&r.fields("Price")&"</td>"
  44. response.write "<td><input type='text' size='1' value = '1' ></td>"
  45. response.write "<td><input type='submit' onclick='buy(me)' value='buy this product' name='"&n&"'></td>"
  46. response.write "</tr>"
  47. n=n+1
  48. r.movenext
  49. loop
  50. response.write "</table>"
  51. response.write "</form>"
  52. %>
  53.  
  54. </body>
  55. </head>
  56. </html>
  57.  
i want to build asp store but simple not somthing hard and at the other page like order.asp i dont know how to find which product the Ueser/client chose
Apr 3 '10 #5
RedSon
5,000 Expert 4TB
Next time use code tags. Please read up on "how to ask a question" located here -> http://bytes.com/faq.php?faq=how_to_ask_a_question.

Please do post code without code tags in the future.
Apr 5 '10 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Jonas Daunoravicius | last post by:
The subject pretty much sums up what I need to do. Here is what I have so far, but still can't figure out how to get it working: <script language="javascript" type="text/javascript"> function...
6
by: BP Prgm | last post by:
This is my VBScript function: <script language="JavaScript" type="text/JavaScript"> Dim UN Set objNet = CreateObject("WScript.NetWork") Set objUser = GetObject("WinNT://my domain/" &...
3
by: Matt | last post by:
<% hour = Request("controlname") %> will yield the following error: Microsoft VBScript runtime (0x800A01F5) Illegal assignment: 'hour' However, if I declare hour, then it is fine. <% Dim...
8
by: Dave Thomas | last post by:
I have developed a web site using asp pages that use both vbscript and javascript. Run the site on my PC and everything is fine. Ftp to my web hosting provider which hosts asp pages and look on my...
6
by: ASPfool | last post by:
Hello everyone, Please help me before I throw my computer out of the window: I'm working on a web application in classic ASP (vbscript), which is making calls to some webservices. The calls...
2
by: ChucRock | last post by:
Hi, I have the following code where there is some client side VBScript that does something and needs to pass a variable back to the ASP.NET page. When the page is updated through a postback, the...
2
by: alan | last post by:
Hi all, I need to pass a variable to the client-side vbscript and when the button is pressed invoke the script (SomeSub()). The problem is, that the "blablabla" appears only after second...
3
by: hermand | last post by:
I've got an online job application I am building using ASP/VBScript. The application consists of one ASP document which has three separate states. States: 1. Form Display 2. Form Review...
12
by: Jim Rodgers | last post by:
I have a big asp file that has an error under certain conditions -- totally repeatable. However, it only fails when I set response.buffer = True at the top. WHen I set it False in order to debug...
3
by: Michael | last post by:
Hi. I have COM+ component installed on my XP. I have problem to create instance of it inside vbscript. How can I do it? The error I get is : ActiveX component can't create object. Thanks
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.