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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T13:48:29+00:00 2026-05-13T13:48:29+00:00

This question can best be asked by example. Say I have a database table

  • 0

This question can best be asked by example. Say I have a database table called “Car” with the following columns:

(Make*, Model*, NumberOfDoors*, Description, Price, Mileage, Color)

The 3-tuple of Make, Model, and NumberOfDoors makes up the unique primary key in the database. What I’ve done is made a “Car” class for each line item, but if I want to have a collection of cars objects in the form of

{(Particular make model and doorcount, count, current sales), …}

where the first element of each item in the collection is the unique type of car, the second is the count (how many of that type I have), and the third element is any curent sales on that make-model-doorcount, I’m running into a data structure dilemma.

What I’ve been doing so far is making an struct that fits into a hashtable, as below:

//This will be the unique key for the hashtable
dim uniqueID as String = myCar.make + "@" + myCar.model + "@" + myCar.doorCount

//This is the structure that will hold the perinent info about that unique
//car type
Structure inventory
    Dim count as Integer
    Dim currentSales as String
End Structure

At this point I’d proceed to fill the hashtable from the database table, where the key to the hashtable is the uniqueID string, and the value is an instantiation of the “inventory” struct. This is (in my opinion) very inelegant though, especially the hacked together uniqueID for the hashtable. Is there a better data structure solution for objects that have a primary key consisting of multiple values?

  • 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-13T13:48:30+00:00Added an answer on May 13, 2026 at 1:48 pm

    You can use the actual class or structure as your primary key.

    Just override GetHashCode and Equals – this allows you to use the object itself as the key in a Dictionary, with multiple values being taken into account.

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

Sidebar

Ask A Question

Stats

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

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

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

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

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer A lot of good information from everyone, and I really… May 13, 2026 at 5:49 pm
  • Editorial Team
    Editorial Team added an answer You tried to put in data that was longer than… May 13, 2026 at 5:49 pm
  • Editorial Team
    Editorial Team added an answer I believe you can't read sms directly from your inbox.… May 13, 2026 at 5:49 pm

Related Questions

Recently I have been studying recursion; how to write it, analyze it, etc. I
This has been driving me nuts. I hope it's not been asked before but
I have noticed that some of my ajax-heavy sites (ones I visit, not ones
This is mostly a rhetorical question, as far as I've checked the answer is
What are some situations where languages should be mixed? I'm not talking about using

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.