I am creating Windows Application Form using Visual Studio 2010.
For now, I am in this situation:
I allow users to add items into the system, each item they may have different brand, cost & suppliers and selling price for different customers.
For example,
Item1, Name: ABC, Brand: TIM and
Item2, Name: ABC, Brand: LD.
when the users want to insert the cost and suppliers information into Item1, when they click on the “ShowCost” button, another Windows Form will pop out for the users to fill in. And I’m planning to use DataGridView for that. I’m planning to use the Item Name and Brand for identifying the cost and selling price for the item
So here’s my question,
How do I set the query or other solutions in order to check that when the name and brand of the item that the users enter, will show up the cost and the price of the specific items? what is the query that i need to write?
I have created 3 database tables which are ItemInfo(Name, Brand, etc), CostList(Name, Brand, SuppliersName, Cost) and SellingPrice(Name, Brand, CustomersName, SellingPrice).
How do I compare the data from ItemInfo tables to show the data in CostList?
Thanks for the help.
If you are using a database you should consider using Primairy keys. That way you can store information about a certain item in another table. In all three tables you use Name and Brand. I would have modeled my tables like this:
Items
Clients
Suppliers
In the clients table the field SupplierID is a unique number. So when you want to refer to a supplier you simple fill in the SupplierID. For example in the items table the ItemID is the unique identifier for an item. The Supplier ID field is refers to the SupplierID field in the Suppliers table. In order to make sure your datamodel remains consistent I would recommend you to use Foreign key constraints. This makes sure you can not fill in any invalid ID’s
Here’s a short movie explaining some SQL basics