Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Need help and advice with adding datagridview contents to database

Posted on 2011-02-13
7
Medium Priority
?
157 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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 2000 total points
ID: 34884338
Are you using a datatable as a datasource to the grid?
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
This post looks at MongoDB and MySQL, and covers high-level MongoDB strengths, weaknesses, features, and uses from the perspective of an SQL user.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

610 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