Solved

create session variable in c#

Posted on 2006-11-02
2
243 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
Comment Utility
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
Comment Utility
Hi ewang1205,

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

Regards
  Kelvin
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Dynamically create stored procedure   using c# 9 71
Check my code out(2) 1 23
bulid json format 3 15
COnsume rest client 6 4
Bit flags and bit flag manipulation is perhaps one of the most underrated strategies in programming, likely because most programmers developing in high-level languages rely too much on the high-level features, and forget about the low-level ones. Th…
Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

763 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

6 Experts available now in Live!

Get 1:1 Help Now