Solved

Need help and advice with adding datagridview contents to database

Posted on 2011-02-13
7
153 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
MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

 

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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

Creating and Managing Databases with phpMyAdmin in cPanel.
This post looks at MongoDB and MySQL, and covers high-level MongoDB strengths, weaknesses, features, and uses from the perspective of an SQL user.
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

728 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