Click here to Skip to main content
15,900,461 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Dear Coders,

i want to compare a role value from a database table of a particular user with the role i have selected in dropdown list value in an asp.net web page using c# coding. please help me with the coding part of this.thanx...
Posted
Updated 1-Mar-12 9:23am
v2
Comments
Sergey Alexandrovich Kryukov 26-Feb-12 23:13pm    
Not a question. Help with what? What's the problem?
--SA

it's simple...

declared a string variable in webpage, then run the command using executescalar method.
C#
string variablename=commandobject.ExecuteScalar().ToString();
 
Share this answer
 
Comments
Anuja Pawar Indore 1-Mar-12 2:58am    
Added code block
C#
query = select role from table where role='selecte_value';


string role=commandobject.ExecuteScalar().ToString();

if (role.equals(''))
{
// record not exist 
}
else 
//matched
 
Share this answer
 
v2
Comments
Anuja Pawar Indore 1-Mar-12 2:58am    
Added code block
Photon_ 6-Mar-12 5:32am    
Please upvote if it helps
We cannot do your job for you. You will need to research how to call SQL and do this yourself.
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900