I am struggling to find good information how to query data from a CSV file.
I have to query the CSV file to generate reports and then run in the console.
Can anyone help?
These are the fields that I am using below.
Customer Information
Forename
Surname
Date of Birth
Vehicle Information
Manufacturer
Model
Registration number
Registration date
Engine size (in cc)
Owner
InteriorColour (Car only)
Has Helmet Storage (Motorcycle only)
Required Relationships
Customers can have 1 to many vehicles.
Vehicle must have exactly one owner.
Vehicle type cannot be changed once it is created.
Reports
We will require reports to be designed to contain:
All known customers and any vehicles they own.
All customers between the age of 20 and 30.
All Vehicles registered before 1
st January 2010.
All Vehicles with an engine size over 1100.
What I have tried:
Displaying the CSV file in the console
using System;
using System.IO;
namespace PinewoodTest
{
class Class1
{
static void Main(string[] args)
{
try
{
String st = File.ReadAllText("/Users/thomasjeffcock/Projects/PinewoodTest/CustomerInformation.csv");
Console.WriteLine(st);
}
catch(Exception e)
{
Console.WriteLine("The File Could Not Be Read");
Console.WriteLine(e.Message);
}
Console.Read();
}
}
}