Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   Visual Basic (http://www.programmingforums.org/forum18.html)
-   -   SQL in VB 6 (http://www.programmingforums.org/showthread.php?t=14520)

Tony789 Nov 19th, 2007 4:57 PM

SQL in VB 6
 
Hi,

I am trying to input all the contents from a table into a VB flex grid which I am able to do. Then I want to create another loop just for one item in the flex grid. In this loop, the original data in the flex grid is a number. I want to take this number and check for its corresponding string value in another table. With the code below, I get the same string value from the second table for all the original numbers in the flexgrid.

Below is my code:

=====
intj = 1
Do Until rs.EOF = True 'do until all records in recordset
DoEvents

inti = 0

Do Until inti = rs.Fields.Count 'loop start
DoEvents

If Not IsNull(rs.Fields(inti)) Then
MSHFlexGrid1.Row = intj
MSHFlexGrid1.Col = inti
MSHFlexGrid1.TextMatrix(intj, 0) = rs.Fields("CaseID").Value
MSHFlexGrid1.TextMatrix(intj, 1) = rs.Fields("UserID").Value
MSHFlexGrid1.TextMatrix(intj, 2) = rs.Fields("ApplicationID").Value
MSHFlexGrid1.TextMatrix(intj, 3) = rs.Fields("Problem").Value
MSHFlexGrid1.TextMatrix(intj, 4) = rs.Fields("Time_Working").Value
MSHFlexGrid1.TextMatrix(intj, 5) = rs.Fields("Time_Open").Value
MSHFlexGrid1.TextMatrix(intj, 6) = rs.Fields("QueueID").Value
End If

inti = inti + 1
Loop 'loop end

ApplicationID = MSHFlexGrid1.TextMatrix(intj, 2)

AppIDTemp = "select Application from tbl_Applications where ApplicationID = ApplicationID"
conn.Execute AppIDTemp
ApplicationName = rs1.Fields("Application").Value

MSHFlexGrid1.TextMatrix(intj, 2) = ApplicationName

MSHFlexGrid1.Rows = MSHFlexGrid1.Rows + 1

intj = intj + 1

rs.MoveNext
Loop
=====

Thanks for your help.


All times are GMT -5. The time now is 3:27 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC