kwanbis
New member
- Joined
- Sep 3, 2015
- Messages
- 4
- Programming Experience
- 10+
I returned to my university to finish my thesis. Sadly, so much time has passed that I find that they no longer use C to program the thesis (you have to develop a system), but that they now use VB.NET for which I never had a single class. I tried to convince them to let me do it in C, but they won?t allow me so now I have to develop a system using a language I barely understand.
I decided to make a Point of Sale software. Basically, a cashier needs to select from a list of products the products that the customer is purchasing and after all the products have been input on the system, the cashier presses a button and an invoice is printed and the transaction recorded.
I thought of solving this with two datagridviews, one linked to the stock table that would list all the products from the stock, so that when the cashier double clicks on one of the products, the product would be added to the second datagridview. The second datagridview should be empty each time a new customer starts the purchase process, and with each double click on the stock datagridview that product would be loaded to the purchase datagridview.
Once the cashier has finished processing the purchase, he would press the invoice button which would launch a couple of actions: 1) the system would iterate through the purchase datagridview and print the relevant information on the invoice, and 2) all that information would be saved to a tabled called effective_purchases or something like that for record keeping.
I?ve seen some work done by other students but I?m not 100% sure that they are doing the right thing. Basically, they use a SqlDataAdapter to run a query against the stock table, then they use a the .Fill function to fill the DataTable. Then they create a List that holds objects of the type product that are created by iterating through the datatable and that list is assigned to the datasource of the datagridview.
Basically, something like this:
So I have many many doubts. Considering I rather not use datasets, is this the simplest way to link a database table to a datagridview? If not, how should I do it? And once I have the products datagridview linked, how do I make the purchases datagridview? Remember that at first it has to be empty. So, do I create an empty table (temporal) and once the purchase button is press do I copy that temporal table to the definitive purchases table? How?
By the way, I rather NOT use a dataset, as my professors told me it is very complicated and that by using simple queries I should be able to do it.
THANKS A LOT.
I decided to make a Point of Sale software. Basically, a cashier needs to select from a list of products the products that the customer is purchasing and after all the products have been input on the system, the cashier presses a button and an invoice is printed and the transaction recorded.
I thought of solving this with two datagridviews, one linked to the stock table that would list all the products from the stock, so that when the cashier double clicks on one of the products, the product would be added to the second datagridview. The second datagridview should be empty each time a new customer starts the purchase process, and with each double click on the stock datagridview that product would be loaded to the purchase datagridview.
Once the cashier has finished processing the purchase, he would press the invoice button which would launch a couple of actions: 1) the system would iterate through the purchase datagridview and print the relevant information on the invoice, and 2) all that information would be saved to a tabled called effective_purchases or something like that for record keeping.
I?ve seen some work done by other students but I?m not 100% sure that they are doing the right thing. Basically, they use a SqlDataAdapter to run a query against the stock table, then they use a the .Fill function to fill the DataTable. Then they create a List that holds objects of the type product that are created by iterating through the datatable and that list is assigned to the datasource of the datagridview.
Basically, something like this:
Dim adaptadorSQL As New SqlDataAdapter("select * from stock", _conexion) Dim tablaDatos As New DataTable adaptadorSQL.Fill(tablaDatos) Dim ProductsList As New List(Of Product) For Each row As DataRow In TablaDatos.Rows Dim Registro As New Product Registro.ID = Integer.Parse(row("ID").ToString) Registro.Name = row("Name").ToString Registro.Value = Decimal.Parse(fila("Value").ToString) ProductsList.Add(Registro) Next dgvProducts.DataSource = ProductsList
So I have many many doubts. Considering I rather not use datasets, is this the simplest way to link a database table to a datagridview? If not, how should I do it? And once I have the products datagridview linked, how do I make the purchases datagridview? Remember that at first it has to be empty. So, do I create an empty table (temporal) and once the purchase button is press do I copy that temporal table to the definitive purchases table? How?
By the way, I rather NOT use a dataset, as my professors told me it is very complicated and that by using simple queries I should be able to do it.
THANKS A LOT.
Last edited by a moderator: