Comparing values between different MSHFlexGrid
Hello All,
I have created Two tables in MSSQL.
First is, BUYERS_LIST
PRODUCT_NAME BUYERS_PRICE QUANTITY_WANTED
--------------- ------------ ---------------
P1 2500 5
P3 3200 8
P4 1000 2
Second is, SELLERS_LIST
PRODUCT_NAME BUYERS_PRICE QUANTITY_WANTED
--------------- ------------ ---------------
P1 2500 5
P3 3200 8
P4 1000 2
Now, Using Visual Basic Front-End, I have created two
MSHFlexGrid Control namely mshGrid1 and mshGrid2.
I have displayed data of BUYERS_LIST TABLE in mshGrid1 and
SELLERS_LIST TABLE in mshGrid2. Now, Through Visual Basic, I am
inserting some records in both table, after inserting some
records they will appear as follows:
BUYERS_LIST TABLE
PRODUCT_NAME BUYERS_PRICE QUANTITY_WANTED
--------------- ------------ ---------------
P1 2500 5
P3 3200 8
P4 1000 2
P2 3570 7
SELLERS_LIST TABLE
PRODUCT_NAME SELLERS_PRICE QUANTITY_OFRD
--------------- ------------- -------------
P2 5000 10
P6 3000 3
P5 2800 7
P4 1080 4
Hope, I have described basic information, so, U professiona can
solve better, Now, Let me tell the problem..
In visual basic, I want to write such kind of logic code that,
after inserting one-one records in BUYERS_LIST and SELLERS_LIST,
It should first take data from MSHFlexGrid control, that is from
mshGrid1 and mshGrid2, then as u guys can see, after inserting
records BUYER wants P2 7 item worth rupees 3570, but SELLER is
already offered 10 P2 items ( see SELLERS_LIST ). So, Here,
trading is happened, 5000 - 3570 = 1430$, (see recent tables, P2
PRODUCT_NAME row). After trading happened in BUYERS_LIST TABLE,
he needed 7 Quantity and 10 Quantity was offered by Sellers (see
SELLERS_LIST Table), ultimately, P2 row from BUYERS_LIST should
delete and in SELLERS_TABLE, first when there was 10 Quantity,
now it should be 3 because out of 10, 7 has been purchased by
Buyer. That's it, And after deleting P2 row from BUYERS_LIST and
updating Quantity from 10 to 3, it should display in Another
MSHFlexGrid, let we can call it mshGrid3. And let me tell u that,
for third MSHFlexGrid, I have created table, it should display
there, traded $ for sellers (that is 1430$), then product name
P2.
This is Logical problem, But hope from anyone Senior or
Junior Professionals....
Thanks and Waiting for positive solutions..
~~Dev~~
__________________
~ ~ ~ There is no Right, There is no Wrong, KNOWLEDGE is Only the POWER ~ ~ ~
|