Guys, I want to make a purchase list of buyers
example : buyers buy 3 products in 1 Purchase Order.

what tools I use in C #?
What data types used in SQL SERVER database?

Recommended Answers

All 5 Replies

Hi, in the SQl Server you may have many tables and columns as per different scenarios.
The data types would all depend on what you intend to store in the table(s).
So I would request you if you could inform about the column names and their purpose so that I can possibly suggest you the data types accordingly.

I'd say a minimum of 4 tables.

* Customers table
    - CustomerID (Int PK)
    - CustomerName (VarChar)
    - Address (VarChar)

* Products table
    - ProductID (Int PK)
    - ProductName (VarChar)
    - Cost (Float)

* Orders
    - OrderID (Int PK)
    - CurstorID (Int FK)
    - TotalCost (Float)

* OrderDetails table
    - OrderDetialsID (Int PK)
    - OrderID (Int FK)
    - ProductID (Int FK)
    - Quantity (Int)

Having the table structure above means 1 customer can have many orders and 1 order can have more than 1 of many products.

It will give you a more complete set of data if you are doing invoicing, stock taking or generating reports on how well products are selling and which customers are placing the most orders.

commented: Nice & neat +14

So, in my opinion if you want to inter-relate data of 2 or more tables, what you can possibly do is keep a common field like foreign key from 1 table in another.
As per your information provided, I'd recommend you to maintain Customer-Orders relationship and Order-Product relationship...I don't see a use of OrderDeatils table here as you may use a common Order table for both Customer and Product tables but again I cannot recommend you to use this same strategy because it may vary from need to need purposes. I can only suggest you if the same suits your requirements too :)

commented: True also +14

thx for replay.. but.. i don't know tools in c#..
example : datagridview..
what tools i must use in list order?

Well, actually you need to use some controls like the one you said DataGridView, GridView, DataGrid....You can choose one and start working and if you want to know the difference and their pros-cons you may search the web also to have a clear picture because it all depends on what you intend to do.

I can also suggest you some controls however it would be better that you possibly do a quick analysis on what your requirements are and what purposes they would serve in your application.

I hope you understand what I am trying to convey here :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.