Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Assigned session variables to local variables

Status
Not open for further replies.

Sunil606

Programmer
Dec 8, 2003
27
GB
Hello!
Is it possible to assigned session variables to local dim variables. For example


Dim strTech
strTech = Session("Role")

It does not work for some reason. Or is it possible for me to utilize session variables in an sql statement??

Thanks in advance
 
This should be Yes and Yes. Yes you can assign them to local variables and Yes you can use them directly in a sql statement. Try this:
Code:
<%
session(&quot;string&quot;) = &quot;Hello World&quot;
Response.Write &quot;Session Variable: &quot; & session(&quot;string&quot;)
dim strLocal 
strLocal = session(&quot;string&quot;)
Response.Write &quot;<BR>Local Variable: &quot; & strLocal
dim strSQL
strSQL = &quot;select * from table where column1 = '&quot; & session(&quot;string&quot;) & &quot;'&quot;
Response.Write &quot;<BR>SQL String: &quot; & strSQL
%>

mwa
<><
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top