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 116809
In Process

The Archive Base Latest Questions

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

I have a database that has four columns like this level_1, level_2, level_3, level_4

  • 0

I have a database that has four columns like this

level_1, level_2, level_3, level_4

There are also id, name, etc., but only these four are the ones that matter to me at the moment.

I need to know which column, by columnname, has the value ‘BOSS’.

For example, level_2 may have the value BOSS. I need to know that one of the four columns has the code BOSS and which column, by column name, it is.

The reason is that I have to later update this row but I never know where the value BOSS will be. It could be in level_4, for example.

I know there is a columnname property in DataSet, but I cannot figure out how to use that here. I cannot post my code because there are many iterations of it, none of which work. I am hoping I am overlooking something obvious.

I am using ASP.NET 2.0 and ODBC.

Thank you for any ideas.

just to clarify – I do not need to know how to get the columnname per se. The columnname property works well for that. I do not know which column will have the value BOSS above. Once I can determine that I will get the columnname property value.

The reason I do not know which column will say BOSS is because there are other values that could be in any of the four so the data entry person has to pick an open field and put in the code – it is an old database application I inherited.

update:

Here is what i came up with. I do not like it but here it is. It works but it feels wrong:

        String[] myValues = new String[5] {'BOSS', 'ANOTHERCODE', 'ANOTHERCODE', 'ANOTHERCODE', 'ANOTHERCODE'};         int x = 0;             foreach (String level in myValues)             {                 foreach (DataColumn dc in ds.Tables[0].Columns)                 {                     String myColumnValue = ds.Tables[0].Rows[0][x].ToString();                     if (myColumnValue == level)                     { return ds.Tables[0].Columns[x].ColumnName; }                     x += 1;                 }                 x = 0;             } 
  • 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. 2026-05-11T03:14:13+00:00Added an answer on May 11, 2026 at 3:14 am

    Ok, so you have 4 columns that could have the value BOSS. I guess the best way to solve your problem would be to cycle thought these 4 columns until you get the Value BOSS, when you do find it, store the column name on a variable so you can get it back later.

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

Sidebar

Ask A Question

Stats

  • Questions 106k
  • Answers 106k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The question you reference asks which languages promote both OO… May 11, 2026 at 8:59 pm
  • Editorial Team
    Editorial Team added an answer object[] attribs = myPropertyInfo.GetCustomAttributes(typeof(XmlAttribute),false); bool doesPropertyHaveAttrib =attribs.Length > 0; string… May 11, 2026 at 8:59 pm
  • Editorial Team
    Editorial Team added an answer Restructure your design so you have one thread running in… May 11, 2026 at 8:59 pm

Related Questions

First off, let me preface this question by stating that I'm really a pretty
Each product in my database can have at least three and sometimes four or
Setup I have a VBScript for driving the stress testing of a web service.
I was thinking of adding some Achievements to our internal bug-tracking and time logging

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.