Quantcast
Channel: Visual C# forum
Viewing all articles
Browse latest Browse all 31927

Best Way to "View By Category" in DataGridView (C#, SQL)

$
0
0

Hi all,

I've been developing a small, database-driven password manager using c# and SQL. The application simply inserts, updates, deletes, and finally displays your passwords.

One of the features I would like to implement is a "View by Category" feature. Here's a snapshot of the GUI to give you an idea of how this feature would work:

As you can see, the user will click on a category in the ListBox on the lower left of the form and that will determine what is displayed in the DataGridView to the right. I currently only have 1 table named "Passwords" with these columns: PassID, Service, Username, Password.

----------------------------------------------------------------

Should I simply add a "Category" column in the "Passwords" table and SELECT WHERE Category = CategoryListBox.SelectedItem?

I was also thinking of creating a new table for "Categories" with the CategoryID and CategoryName, and then add a column to "Passwords" named CatID that would be joined with the other table.

I realize I've already presented two answers, but I'd like to know which would be best practice, which would be the most simple, and how I might implement this using SQL.


Viewing all articles
Browse latest Browse all 31927

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>