473,385 Members | 1,384 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

convert from static variables to session


Hi,

i m new in C#, and i m trying to prgramm a calculator program in web
application.

My program work very well using a static variables but i need to change
these variables to session variables..

my static variables are:

public static double num1=0,num2=0;
public static string prevOp="";

could you pleas show me how to do that?

thank you in advance

--
nicepg
------------------------------------------------------------------------
Posted via http://www.codecomments.com
------------------------------------------------------------------------

Jun 26 '06 #1
1 1994
Hi,
Have you tried:

Session["num1"] = 0;
Session["num2"] = 0;
Session["prevOp"] = string.Empty;
....

To use the assigned values, do this:

if (Session["num1"] != null)
{
decimal num1 = Convert.ToDecimal(Session["num1"]);
}
....

Hope that helps.
Calvin
"nicepg" wrote:

Hi,

i m new in C#, and i m trying to prgramm a calculator program in web
application.

My program work very well using a static variables but i need to change
these variables to session variables..

my static variables are:

public static double num1=0,num2=0;
public static string prevOp="";

could you pleas show me how to do that?

thank you in advance

--
nicepg
------------------------------------------------------------------------
Posted via http://www.codecomments.com
------------------------------------------------------------------------

Jun 26 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Earl Teigrob | last post by:
I am using C# to program ASP.NET. I am using class of static fields to hold all variables that are common to the application, and I am sure that this is fine. However, I was also using some static...
4
by: Wayne | last post by:
Hi, I'm new to .NET and have a question about the use of static variables vs. session variables in a web form in C#. Instead of using a session variable to hold a string to persist during...
1
by: aliendolphin | last post by:
I'm having a strange problem possibly with Session variables for one user being accessed by another. I use a static utility class with static methods which get and set certain Session variables....
3
by: Mrs. Conni Drejer | last post by:
Please help anyone: I have made a DLL (for DBCommunication) in which I have defined some public static variables/fields in a public class. This because I want these variables to be shared in all...
4
by: Mantorok | last post by:
Hi I have an ASP app which references a few static properties in some of the classes. I understand that you should use Session variables, but is it "possible" to have each session "not"...
2
by: james | last post by:
Hi I am considering storing my session variables within one static object with session scope. The static object will be a class with accessor functions to get and set the equivalent session...
1
by: cobus.lombard | last post by:
I have found it very easy to have a Helper class that has static members which access Session Variables. For example: public class HelperClass { public static doCustomer CurrentCustomer { get...
5
by: dougloj | last post by:
Howdy. I have an ASP.NET application written in C#. I know this sounds nuts, but instead of having multiple .aspx files to display various parts of the Web site, I do almost everything on my...
4
by: =?iso-8859-1?B?Sm9oYW4gU2r2c3Ry9m0=?= | last post by:
It seems that many people experience problems with mix-ups and non-intentional sharing of sessions in ASP.NET. This is often tracked down to the use of static variables for user data, which are...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.