Go Back  Xtreme Visual Basic Talk > Visual Basic .NET (2002/2003/2005/2008, including Express editions) > .NET Database and Reporting > Send edited data back to dataset from combobox


Reply
 
Thread Tools Display Modes
  #1  
Old 07-31-2010, 07:41 AM
BrianRodos BrianRodos is offline
Newcomer
 
Join Date: Jul 2010
Location: Rhodes, Greece
Posts: 1
Default Send edited data back to dataset from combobox

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
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:

Powered by liquidweb