Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 796843
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T22:42:12+00:00 2026-05-14T22:42:12+00:00

I am trying to implement admin login and operators(india, australia, america) login, now operator

  • 0

I am trying to implement admin login and operators(india, australia, america) login, now operator id starts with ‘IND123’ ‘AUS123’ and ‘AM123’

when operator india logs in he can see the details of only members have id ‘IND%’, the same applies for an australian and american users

and when admin logs in he can see details of members with id ‘IND%’ or ‘AUS%’ or ‘AM%’

i have a table which defines the role i.e admin or operator and their prefix(IND,AUS respectively)

In loginpage i created a session for Role and prefix

PREFIX = myReader["Prefix"].ToString();
Session["LoginRole"] = myReader["Role"].ToString(); 
Session["LoginPrefix"] = String.Concat(PREFIX + "%"); 

works fine

In main page(after login) i have to count the number of member so i wrote

string prefix = Session["LoginPrefix"].ToString();
string role = Session["LoginRole"].ToString();
          
if (role.Equals("ADMIN"))
        StrMemberId = "select count(*) from MemberList";
else
    StrMemberId = "select count(*) from MemberList where MemberID like '"+prefix+"'";

That works fine too.

Problem:
I want to constructor parameter something like:

 StrMemberId = "select count(*) from MemberList where MemberID like '@prefix+'";
 myCommd.Parameters.AddWithValue("@prefix", prefix);

Which is not working

Displaying the members in gridview i need to give condition (something like if (role.Equals("ADMIN")) show all members else show member depending on the operator prefix)the list of members in operator mode and admin mode.

where to put the condition in gridview

how to apply these

please suggest something
Regards

Indranil

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T22:42:12+00:00Added an answer on May 14, 2026 at 10:42 pm

    You need to construct your query as follows:

    "select count(*) from MemberList where MemberID like @prefix"
    

    then

    cmd.Parameters.AddWithValue("@prefix", prefix + "%")

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to implement CKEditor in my CakePHP app admin section with a
I'm trying to implement ldapRealm on Glassfish 3.1. I can login fine with the
i'm trying to implement a very basic (at this point) login screen with JSF
I'm trying to implement conflict detection in an admin system i.e. Alice is editing
Hi i was trying to implement facebook login for my django app using django-facebook
I'm trying to implement a simple form-based login for my web application deployed with
I am trying to implement Northwind database model in MySQL using Django-admin for displaying
I am trying to implement an admin feature on my site that allows an
I have been trying to implement a search page for the admin of my
Trying to implement a rating system of users and postings. What is the best

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.