Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB How-To
|
VB How-To Ask your "How do I do this with VB?" questions in this forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB How-To 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 April 5th, 2005, 12:41 AM
Registered User
 
Join Date: Apr 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Comparing data from 2 datagrids

i'm a beginner to vb6. i wonder if you can help me with this codes.

    myStrOn = "SELECT count(*) as AttRate, SubjID FROM tblAttendance WHERE StudID = 'S000000001' and Attendance = 1 group by SubjID;"

    myStrCount = "SELECT count(*) as TotalRate, SubjID FROM tblAttendance WHERE StudID = 'S000000001' group by SubjID;"


    adoRate.RecordSource = myStrOn
    adoRate.Refresh
    dgRate.Refresh

    adoAll.RecordSource = myStrCount
    adoAll.Refresh
    dgAll.Refresh

    x = dgRate.Columns(0) / dgAll.Columns(0) * 100
    MsgBox x

Sample data from datagrid
[u]dgRate</u>
AttRate SubjId
5 Vb
3 ISE

[u]dgAll</u>
TotalRate SubjID
20 Vb
15 ISE

The main purpose is that i want to calculate the 1st column and row of dgRate (5) with the 1st column and row of dgAll(20), and continue with the following rows. But the above codes only show the answer for the 1st row.

I would appreciate your feedback. Thank you.







Similar Threads
Thread Thread Starter Forum Replies Last Post
datagrids dhoward VB.NET 2002/2003 Basics 8 May 24th, 2007 09:07 AM
Problem comparing xml data vb6 method Pro VB 6 5 May 9th, 2007 11:19 AM
Datagrids Textbox Laxmikant_it ASP.NET 1.0 and 1.1 Professional 2 January 22nd, 2007 11:03 AM
Datagrids dhoward VB.NET 2002/2003 Basics 1 January 2nd, 2007 01:06 AM
Datagrids Louisa VB.NET 2002/2003 Basics 2 September 25th, 2004 09:55 AM





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