|
-
Aug 23rd, 2012, 05:52 PM
#1
Thread Starter
Member
Updating Tables after complex query (datagridview)
Suppose I have two tables as follows:
Products TABLE columns:
ProductID Type Country Description
0001 Widget USA Medium widget
0002 Widget China Large widget
0003 Widget China Small widget that looks like a thingie
0004 Thingie USA Red,White and Blue Thingie
Stock TABLE columns:
ProductID Store # Cost Price Quantity
0001 1 10 20 3
0001 2 12 20 2
0002 1 5 10 10
0003 2 8 12 4
etc
My main form has a textbox into which the used types selection criteria such as
"Type = 'WIDGET' and Cost <= 10" and can specify a sort order. so I create a
sql string like "Select * from Products,Stock where Products.ProductId =
Stock.ProductID and <user's selection criteria>"
I then have a datagridview that displays the results of the search. The columns
of the datagridview include all the columns from the products and the stock table.
I have figured out how to do all this, but even though I can edit cells in the
datagridview, I cannot save the changes back to the original tables because the
sql selects from more than one table.
So, I would like to have the user be able to double-click on a row of the dgv
which would bring up another modal form with textboxes showing the
values in that row. The user should then be able to edit the values from the STOCK
table and save the results.
I also want the user to be able to (in this 2nd form) scroll up and down the
rows of the dgv using a BINDINGNAVIGATOR control.
This is where I get confused as to how to implement it. Any help will be appreciated.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|