CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> .NET

 custom session variable

Print topic Send  topic

Author Message
ajax

Posts: 5
Posted: 01/29/2009, 11:26 AM

I have been having problem creating a custom session variable in vb.net
Basically, I have a users table which contains user login information. 'OfficeID' is a field on the users table and all I want to do is to add this field as a custom session variable when the user logs in. Here is the code:

System.Web.HttpContext.Current.Session("officeID")=(new IntegerField("",Settings.MyConnectionDataAccessObject.ExecuteScalar("SELECT officeID FROM Users WHERE user_login = '" & Session("user_ID") & "'"))).Value.

I create a form with a textbox to test the custom session variable; I set the default value to:
HttpContext.Current.Session("officeID"), but it returns empty. So I added 3 more textboxes to capture the user_id , groupID & user_login session variable , all returned correct except for the custom session variable , could someone help me out with this.
View profile  Send private message
bobhuff

Posts: 21
Posted: 02/04/2009, 2:16 PM

You may want to create a new TextField instead of IntegerField. Session variables value are a text type.

Best,
Bob
View profile  Send private message
Tuong Do
Posted: 02/04/2009, 5:19 PM

Your database lookup always return a NULL value
You should change
WHERE user_login = '" & Session("user_ID")
To
WHERE user_login = '" & Session("user_login ")


"ajax" <ajax@forum.codecharge> wrote in message
news:8498202ec24547@news.codecharge.com...
>I have been having problem creating a custom session variable .
> Basically, I have a users table which contains user login information.
> 'OfficeID' is a field on the users table and all I want to do is to add
> this
> field as a custom session variable when the user logs in. Here is the
> code:
>
> System.Web.HttpContext.Current.Session("officeID")=(new
> IntegerField("",Settings.MyConnectionDataAccessObject.ExecuteScalar("SELECT
> officeID FROM Users WHERE user_login = '" & Session("user_ID") &
> "'"))).Value.
>
> I create a form with a textbox to test the custom session variable; I set
> the
> default value to:
> HttpContext.Current.Session("officeID"), but it returns empty. So I added
> 3
> more textboxes to capture the user_id , groupID & user_login session
> variable ,
> all returned correct except for the custom session variable , could
> someone help
> me out with this.
>
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.yessoftware.com/
>


Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

PHP Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.