In Visual Studio C#, I am creating a cashier sales system and want to have a database to store the values of the sales, products etc instead of creating an array to store the pre-defined values inside a class. I have created a Local Database C# item and created a table with values inside but when I want to access those values I do not know how.
I've searched the internet(where I found out about the database item) and it leads me to having to connect to the database first. Is this necessary? and If so how do you connect to it?
I've done this below but when I run my program nothing appears
SqlConnection x = new SqlConnection("Server=localhost;"+ "Database=Database1;"); x.Open();
Thank you very much, Student_SS
P.S Forgive me if this is actually a basic question, my teacher has not taught this but I am required to do it for a project.