|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
IS VB buggy - oops I solved it sorry
oops, my fault, I forgot conn.begintrans and conn.committrans and then refresh my data display.
I am using VB6.0 sp5. I have a cmd button that updates a database, refreshes a data control which inturn displays to a data grid. I have a second button that does the same thing with some additional code. The first button displays a refreshed table after I click it. The second button does not. If I create a refresh button that just refreshes the data it works. Have you had any experience with buggy behavoir in VB6? Is there a solution? Private Sub cmdResetGroup_Click() Dim grp grp = cmbResetGroup.Text SQL = "UPDATE GameInfo SET " & grp & " = FALSE" adoConn.Execute (SQL) SQL = "UPDATE PlayerInfo SET " & grp & " = FALSE" adoConn.Execute (SQL) SQL = "UPDATE PlayerActions SET " & grp & " = FALSE" adoConn.Execute (SQL) Call refreshTables End Sub Private Sub Command3_Click() Dim fieldName As String Dim fieldValue 'Dim lstBox As ListBox Dim SQL As String On Error Resume Next adoConn.Execute ("Drop TABLE GameInfo2") adoConn.Execute ("Drop TABLE PlayerInfo2") adoConn.Execute ("Drop TABLE JoinGamePlayerInfo") On Error GoTo 0 adoConn.Execute ("SELECT Game_ID, PokerType, LimitType, LowLimit, HighLimit, RealOrPlay INTO GameInfo2 FROM GameInfo") adoConn.Execute ("ALTER TABLE GameInfo2 ALTER Game_ID INT") adoConn.Execute ("SELECT Game_ID, Player_ID, PlayerName, Result INTO PlayerInfo2 FROM PlayerInfo") adoConn.Execute ("ALTER TABLE PlayerInfo2 ALTER Player_ID INT") adoConn.Execute ("SELECT * INTO JoinGamePlayerInfo FROM GameInfo2 INNER JOIN PlayerInfo2 ON GameInfo2.Game_ID=PlayerInfo2.Game_ID") adoConn.Execute ("Drop TABLE GameInfo2") adoConn.Execute ("Drop TABLE PlayerInfo2") adoConn.Execute ("ALTER TABLE JoinGamePlayerInfo ADD COLUMN Keep BIT") 'adoConn.Execute ("ALTER TABLE JoinGamePlayerInfo ADD COLUMN Game_ID") adoConn.Execute ("UPDATE JoinGamePlayerInfo SET Keep = FALSE") For iLstBox = 0 To 6 Set lstBox = SQLControls(iLstBox) fieldName = Replace(lstBox.Name, "lstg", "") fieldName = Replace(fieldName, "lstp", "") fieldName = Replace(fieldName, "lsts", "") AllSelected = True For i = 0 To lstBox.ListCount - 1 If lstBox.Selected(i) Then fieldValue = lstBox.List(i) If Not (fieldValue = "All") Then AllSelected = False Exit For End If End If Next i adoConn.Execute ("UPDATE JoinGamePlayerInfo SET Keep = TRUE") SQLstart = "UPDATE JoinGamePlayerInfo SET Keep = FALSE " SQLset = "" For i = 0 To lstBox.ListCount - 1 If lstBox.Selected(i) Then fieldValue = lstBox.List(i) fieldValue = Replace(fieldValue, "'", "''") If (fieldValue = "All") Then ElseIf (IsNumeric(fieldValue)) Then If (SQLset = "") Then SQLset = fieldValue Else SQLset = SQLset & "," & fieldValue End If Else If (SQLset = "") Then SQLset = "'" & fieldValue & "'" Else SQLset = SQLset & ",'" & fieldValue & "'" End If End If End If Next i If Not (SQLset = "") Then adoConn.Execute (SQLstart & "WHERE " & fieldName & " NOT IN (" & SQLset & ") And Keep = True") adoConn.Execute ("DELETE * FROM JoinGamePlayerInfo WHERE Keep = FALSE") End If Next iLstBox Dim grp As String grp = cmbGroup.Text SQL = "UPDATE GameInfo SET " & grp & " = FALSE" adoConn.Execute (SQL) SQL = "UPDATE GameInfo SET " & grp & " = TRUE WHERE Game_ID IN (SELECT GameInfo2_Game_ID AS GAME_ID FROM JoinGamePlayerInfo)" adoConn.Execute (SQL) Call refreshTables On Error Resume Next 'adoConn.Execute ("Drop TABLE GameInfo2") 'adoConn.Execute ("Drop TABLE PlayerInfo2") 'adoConn.Execute ("Drop TABLE JoinGamePlayerInfo") On Error GoTo 0 End Sub Last edited by GeorgeF : April 17th, 2003 at 11:25 PM. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Visual Basic Programming > IS VB buggy |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|