Solved

create session variable in c#

Posted on 2006-11-02
2
253 Views
Last Modified: 2010-04-16
I try to create session variable in c#.  Here is the code, but it says 'System.Web.UI.Page.Session' is a 'property' but is used like a 'method'       .  Please help.

Session("seq") =  System.Convert.ToString(CMD.ExecuteScalar());
0
Comment
Question by:ewang1205
2 Comments
 
LVL 35

Accepted Solution

by:
Raynard7 earned 170 total points
ID: 17862323
Hi,

The problem is that you are using an example that is using old ASP or VBScript principles

for c# the session is an array and as such you should do your assignment in the form

Session["key"] = "value";

http://www.webmonkey.com/webmonkey/03/30/index3a.html?tw=programming
0
 
LVL 8

Assisted Solution

by:KelvinY
KelvinY earned 80 total points
ID: 17862337
Hi ewang1205,

Try
  Session["seq"] =  System.Convert.ToString(CMD.ExecuteScalar());

Regards
  Kelvin
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
need to convert function to c# 5 45
locate sql commands in C# visual studio Project 6 45
Nested forach loop to linq 3 30
Convert VB web project to C# 3 42
This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question