Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old April 17th, 2003, 08:28 PM
GeorgeF GeorgeF is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Posts: 23 GeorgeF User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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
Comments on this post
JimmyGosling agrees!

Last edited by GeorgeF : April 17th, 2003 at 11:25 PM.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming > IS VB buggy


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway