I am a real novice with VB and I have been struggling to find the answers from forums where answers relate to different programs. I am using Visual Basic 10 express and sql server to create a football league table. I have a form with the first 2 combo boxes bound to Table 1 which produces the fixture date between the 2 selected teams and links through a set relationship to 12 more combo boxes which show the stats for the home team which is bound to table 2. On entering the score and clicking a button the stats update on screen. Here is the problem. I cannot get the data back to the row even though the code reports success. I suspect that this code updates from the dataset to the databse. Here is the relevant code. Any help much appreciated
Public Sub Update_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUpdate.Click
HomeStats.Text = AwayTeam.Text
Played.Text = (Val(Played.Text) + 1)
If Val(HomeScore.Text) > Val(AwayScore.Text) Then HomeWon.Text = Val(HomeWon.Text) + 1 : Points.Text = Points.Text + 3
If Val(HomeScore.Text) = Val(AwayScore.Text) Then HomeDrawn.Text = Val(HomeDrawn.Text) + 1 : Points.Text = Points.Text + 1
If Val(HomeScore.Text) < Val(AwayScore.Text) Then HomeLost.Text = Val(HomeLost.Text) + 1
GoalsFor.Text = Val(GoalsFor.Text) + Val(HomeScore.Text)
GoalsAgainst.Text = Val(GoalsAgainst.Text) + Val(AwayScore.Text)
GoalDiff.Text = GoalsFor.Text - GoalsAgainst.Text
Try
Me.Validate()
Me.LeagueTableBindingSource.EndEdit()
Me.LeagueTableTableAdapter.Update(Me.MatchDataSet.Tables(1))
MsgBox("Update successful")
Catch ex As Exception
MsgBox("Update failed")
End Try