Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > convert from static variables to session

Reply
Thread Tools

convert from static variables to session

 
 
nicepg
Guest
Posts: n/a
 
      06-25-2006

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
------------------------------------------------------------------------

 
Reply With Quote
 
 
 
 
=?Utf-8?B?Q2FsdmluIEtE?=
Guest
Posts: n/a
 
      06-26-2006
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
> ------------------------------------------------------------------------
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Thread safety problems with function scope static variables vs class static private members Hicham Mouline C++ 5 12-19-2008 08:10 PM
Static inline functions with static local variables Martin Wells C Programming 10 10-08-2007 03:38 PM
How can I access non-static variables from static funcition? Neviton C++ 9 09-17-2007 10:21 PM
Session Variables and Static Variables cobus.lombard@gmail.com ASP .Net 1 03-26-2006 11:05 AM
Instantiating a static class( Class with all static members - methods and variables) SaravanaKumar Java 6 10-19-2004 08:20 AM



Advertisments