Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB Databases Basics
|
VB Databases Basics Beginning-level VB coding questions specific to using VB with databases. Issues not specific to database use will be redirected to other forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB Databases Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 28th, 2005, 07:39 AM
Authorized User
 
Join Date: Nov 2005
Posts: 34
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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 ~ ~ ~





Similar Threads
Thread Thread Starter Forum Replies Last Post
Comparing Two values from same table MArgente BOOK: Beginning SQL 3 December 11th, 2009 07:35 AM
Comparing values between different MSHFlexGrid davekrunal46 Visual Basic 2005 Basics 0 November 28th, 2005 07:42 AM
Comparing values between different MSHFlexGrid davekrunal46 VB How-To 0 November 28th, 2005 07:41 AM
Comparing values between different MSHFlexGrid davekrunal46 Beginning VB 6 0 November 28th, 2005 07:38 AM
Comparing values between different MSHFlexGrid Con davekrunal46 Pro VB Databases 0 November 28th, 2005 07:36 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.