Solved

Need help and advice with adding datagridview contents to database

Posted on 2011-02-13
7
150 Views
Last Modified: 2012-05-11
Hi,
   I am writing a .net EPOS and Stock Control system.  basically I have the menu and the main EPOS screen completed, when someone clicks a value from the various items i.e. Chicken and Chips, the details get added to a row in a Data Grid View, which the user can click the row in the view to have all the values output to seperate text boxes to make easier to read.  If there are 5 rows in the data grid view, what would be the best way of updating my locally installed MySQL database?

I would like it so that under a transaction of say the following:

1 x Large Chips 99p
1 x Chicken and Chips 3.99
1 x Chicken Burger 1.99

Then each individual row or item can be added both to the single transaction but also each row be added seperately as this is where the stock control would come in.

Can anyone give any advice on best way forward?

Cheers
0
Comment
Question by:damianb123
  • 4
  • 3
7 Comments
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 34883875
Not sure I understand your question but this is usually done using two tables.

Orders (OrderID, Date, CustomerName, ...)
OrderDetails(OrderDetailID, OrderID, ProductID, Quantity, Amount, ...)
0
 

Author Comment

by:damianb123
ID: 34883986
I understand the need for two tables. What I need help with is:

A) getting the value from each column in the datagridview into the database I.e item name added to a database field called the same!

B) breaking down each item I.e chips and chicken into two further values in a database of chicken, and another for chips for the stock inventory.....

Thanks
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 34884016
Is it an option to split the two items into separate lines?
0
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 

Author Comment

by:damianb123
ID: 34884121
Hmmm, not as the operator sees, so when they click a button on the form, a row appears in the datagridview. I need this row to be entered as a new entry in the transaction database, and another entry be made for the item name field of new row! But I also need to be able to strip the chicken element out of chicken and chips and add separate.... If that makes sense, the last part for stick control....
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 34884164
That's fine for chicken and chips but there would be other similar combos right? Like burger and chips.

What you can do is add a separate table (called bundles/meals etc) which would be used to combine products. Now in the orderdetails table, you would use mealid but you can use this mealid to get to individual product items.
0
 

Author Comment

by:damianb123
ID: 34884210
Could you possibly show me code to first update the table from the datagridview? Then we can go from there? Cheers
0
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 500 total points
ID: 34884338
Are you using a datatable as a datasource to the grid?
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Both Easy and Powerful How easy is PHP? http://lmgtfy.com?q=how+easy+is+php  Very easy.  It has been described as "a programming language even my grandmother can use." How powerful is PHP?  http://en.wikipedia.org/wiki/PHP  Very powerful.  But a…
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question