?
Solved

create session variable in c#

Posted on 2006-11-02
2
Medium Priority
?
264 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 35

Accepted Solution

by:
Raynard7 earned 680 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 320 total points
ID: 17862337
Hi ewang1205,

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

Regards
  Kelvin
0

Featured Post

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses
Course of the Month11 days, 22 hours left to enroll

752 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