passing variables between asp and vbscript codes

  cyberpharmacist 17:09 05 Oct 2003

Hi All,

I am trying to pass some values between asp codes in % %> and script language=vbscript> /script>.

This is because there is this vb script function which I need to use for OWC (office web component) and I need to pass some variables from the database (retrieved from the database) to the function, but even calling the function is from the listbox_onchange, so I am not sure how i can do that. but knowing how to pass the variable will be a good start i think.

many thanks.

  Taran 17:40 05 Oct 2003

You can transfer variables in a number of ways and for a range of purposes.

On a form:


<INPUT TYPE="text" NAME="var1">

<INPUT TYPE="text" NAME="var2">


Retrieving data through a form can be done by using METHOD=POST, like this:




You can use:

Request.QueryString("var1") etc for METHOD=GET.





works for GET and POST.


Let's say you have a test file (page.asp)

To send in the URL:


This assumes that var1 and var2 are your variables: obviously you have to use a question mark (?) after the URL filename and more than one variable is separated by an ampersand (&) in the URL.


Retrieving data requires something along the lines of the following:




At this point I should mention that you still need to include the full http :// w w w. and so on of the web page address.


Session variables are another possibility:



session("var1") = "X"

session("var2") = "Y"




var1 = session("var1")

var2 = session("var2")


This is particularly useful where the variables will be used on multiple pages instead of an explicit pass.


You've opened up a huge can of worms and there is no easy answer.

One point: it can be simpler all round to pass variables using ASP with Javascript instead of using VBScript.

Search for tutorials online and you will find loads of free information on this and similar processes.

Without knowing exactly what it is you want to do and why, it is impossible to be anything other than very general with an answer.



This thread is now locked and can not be replied to.

Elsewhere on IDG sites

Samsung Galaxy S9 review

Wacom Cintiq Pro 24 and 32 review – hands-on

Best Mac video editors

Idées cadeaux pour geeks et tech addicts