Database query for search

Hi all,

I've got a query please that any comments would be greatly appreciated.

I have a program done already which is a hair salon booking appointment ConsoleApp. The ConsoleApp has Customer details, Staff details and Booking details. These infos are saved in StreamWriter Text File.

So, what I need now is to add a Search to the ConsoleApp so that I can use Booking ID to Search a Customers appointment date the Customer booked already.

Any ideas?

Lots of thanks
Well if you've done all that you've said you've done, a search is just a for loop and an if statement.

Interesting that you said StreamWriter.
https://docs.microsoft.com/en-us/dotnet/api/system.io.streamwriter?view=net-6.0
Is your program written in C++ or C#?

or c++/cli ?
if you need to search the data a lot after a query, store a pointer (will be like a database index) to the data in an unordered map by booking id.
if its a one of a kind, don't search, that is what the database is supposed to be good at. Inject a where clause into that query and re-run it for only the ID you needed.

if there isnt actually a database (are you calling your text file a database?!) the first answer will still work, but the where clause won't -- you will just have to make a decision based off the requirements....
Last edited on
thanks both so much, its c#
@jonnin thanks so much for the response, going to give the first suggestion a go and hope this will solve it. really appreciate all of your time!. Nina x
System.Collections.Generic.Dictionary<TKey, TValue> and System.Collections.Hashtable
appear to be C# for our c++ maps.
it is not uncommon to have multiple tables for one set of data so you can search on a number of things efficiently.

this is not the best place for c# help -- we pretty much stick to C and C++. You can ask, but not everyone here even knows c#.. I have done maybe 3 very small projects in it.
Last edited on
thanks so much again jonnin, really appreciated your help x
Topic archived. No new replies allowed.