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

  • Home
  • SEARCH
  • 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 6185601
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T01:44:37+00:00 2026-05-24T01:44:37+00:00

I have staff table staff_Id staff_Accesscode values (access123,code123,staff12)…. i have done like this for

  • 0

I have

staff table
staff_Id
staff_Accesscode values (access123,code123,staff12)....

i have done like this for getting all values in staff_accesscode

DataTable dt2 = null;
string sql = @"SELECT staff_AccessCode FROM staff";
dt2 = xxxxxx.GetData(sql, gBaseUrl);
if (dt2 != null && dt2.Rows.Count > 0)
{
   accessname = dt2.Rows[0]["staff_AccessCode"].ToString();
}

but the problem is it returns only last value stored in staff_Accesscode, I mean it returns only this value (staff12)

now i want to get the all values stored in staff_Accesscode field and further i want to check this value with the txtbox.text

  • 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-24T01:44:37+00:00Added an answer on May 24, 2026 at 1:44 am

    You are accessing the first row (with index 0) only.
    You might iterate through the complete result set:

    for ( int i = 0; dt2 != null && i < dt2.Rows.Count; ++i )
    {
        String tmp = dt2.Rows[ i ]["staff_AccessCode"].ToString();
        if ( tmp.Equals( what_ever_variable_or_constant /* e.g., txtbox.Text */ ) )
        {
            accessname = tmp;
            //break; ?
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Not quite sure how to get this one. I have a staff table and
We have a table like below in an sql server 2005 db: event_id staff_id
We have a company intranet with staff management functions. I would like to begin
I have a table of Users (tblUsers) which contains details of University staff. I
Ok, so my schema is this: Table: Timesheet_Hours Columns: Timesheet_Id (PK, int) Staff_Id (int)
how can I count row based on its contents? assumed I have table like
I have three tables and they look like this: users_table categories_table depart_table u_id cid
I have a table called Staff and a table called Supervisors. Staff has StaffID
In a scenario where I have a table like so: int id (PK) int
I'm having a serious brain fart over this but essentially i have a table

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.