Windows Develop Bookmark and Share   
 index > Windows Forms General > Adding ColumnName to a DropDownList
 

Adding ColumnName to a DropDownList

I have a problem which some wise and smart person would be able to help me with.

I currently have a table in an Access database which is as follows:
ColumnName - Type Example
Username -TEXT NakedProgrammer
Password -TEXT ******** (thenaked)
NewYork -YES/NO NO
LasVegas -YES/NO YES
Washington -YES/NO YES

The purpose is if you have lived in "NewYork" for example then you have a YES value. If you haven't then you get a NO value.

What i want is that when a person puts in his/her Username and Password combination, a DropDownList is populated with the ColumnTitles.

So using the above example data, if I log in using my username and password ("NakedProgrammer" and "thenaked"). I click the login button and the DropDownList should have the values of "LasVegas" and "Washington" in it, not "NewYork".

Does anybody know the best way to do this, is there a nice simple way?


Using:
Microsoft Visual Studio 2005.
Windows XP
Using C++ to make a Website

Thanks,
The Naked Programmer





using Yes/No valued columns to add column name to dropdown textbox
The Naked Programmer  Friday, October 13, 2006 7:34 AM
The fact you are running in to this problem now indicates aflaw in your database design. If this is one of the needs, the design should be so that it supports simple querying of this information.

I think I would make if-statements for each column, and add the names of the columns where the value is yes to a stringinthat query, separated by semicolons. After getting that, you can string.Split() on the semicolons en use the resultinglist for the dropdown.
Rick van den Bosch OLD  Friday, October 13, 2006 8:08 AM

You can use google to search for other answers

Custom Search

More Threads

• eseutil on exchange 5.5
• Can winforms apps be developed for a client/server architecture?
• Treeview images and listview problems
• dos window question
• Chage Image Shapes
• Open an existing excel sheet and populate data into it
• Resize form when Maximized
• BUG: ContextMenu Shortcut (Accelerator) Problem
• Spell Check a textbox in .NET 3.0
• WebBrowser and Backgroundworker problem