Click here to Skip to main content
13,004,421 members (78,689 online)
Rate this:
Please Sign up or sign in to vote.
See more:
I have retrieved a value from database into session as
with query i got username from database into var p

if i want to print the name into label
i write

it should print only username but it is printing column name too(like {username=aman})
what should i do?
remember i'm getting value from database
Posted 6-Nov-12 18:04pm
Updated 6-Nov-12 18:15pm
Neelam Chandra (8015059) 7-Nov-12 0:08am
Which type of variable 'p' is? can u show the code u storing data in variable p?
Sanjay K. Gupta 7-Nov-12 0:17am
store this way value in session
I thing you are storing the "DataRowView" object in session.
Milind Thakkar 7-Nov-12 0:23am
Why you reposting questions with same subject

If the question is different, atleast change subject appropriately. This confuses members.

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

string str = session["username"].ToString();
str = str.Remove(0,9);
label.Text= str;

It removes 'username=' and displays only the text 'aman'.
Hope you can use remove function and (0,9) as 'username=' is same for every data base call here in your program.
Dee_Bee 7-Nov-12 23:23pm
did you try this ?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.170627.1 | Last Updated 7 Nov 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100