Solved

create session variable in c#

Posted on 2006-11-02
2
245 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

929 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now