M
MadCrazyNewbie
Hey Group,
Could sombody possibly have a look at the following code for me please?
It all works fine but when I click on the btnUpdate_Click, after making
changes to the data, it just seems to load the old Dataset again, I checked
mydatabase and no of the changes had taken effect in there?
Im pretty should its something nice and simple I jut carn`t se what
Heres the Code:
Private Sub btnUpdate_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnUpdate.Click
Try
Me.UpdateDataSet()
Catch eUpdate As System.Exception
System.Windows.Forms.MessageBox.Show(eUpdate.Message)
End Try
Me.dsArcirisUsers_PositionChanged()
End Sub
Private Sub btnLoad_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnLoad.Click
Try
mlLoading = True
Me.LoadDataSet()
Catch eLoad As System.Exception
System.Windows.Forms.MessageBox.Show(eLoad.Message)
Finally
mlLoading = False
End Try
Me.dsArcirisUsers_PositionChanged()
End Sub
Private Sub dsArcirisUsers_PositionChanged()
If Me.BindingContext(dsArcirisUsers, "ArcirisUsers").Position <> -1
Then
Me.cboArcirisUsersPrimarySite.SelectedValue =
dsArcirisUsers.ArcirisUsers.Rows(Me.BindingContext(dsArcirisUsers,
"ArcirisUsers").Position).Item("SitesID")
End If
Me.lblNavLocation.Text = (((Me.BindingContext(dsArcirisUsers,
"ArcirisUsers").Position + 1).ToString + " of ") +
Me.BindingContext(dsArcirisUsers, "ArcirisUsers").Count.ToString)
End Sub
Public Sub UpdateDataSet()
Dim objArcirisUsersDataSetChanges As Excellence.NET.dsArcirisUsers =
New Excellence.NET.dsArcirisUsers()
Me.BindingContext(dsArcirisUsers, "ArcirisUsers").EndCurrentEdit()
objArcirisUsersDataSetChanges = CType(dsArcirisUsers.GetChanges,
Excellence.NET.dsArcirisUsers)
If (Not (objArcirisUsersDataSetChanges) Is Nothing) Then
Try
Me.UpdateDataSource(objArcirisUsersDataSetChanges)
dsArcirisUsers.Merge(objArcirisUsersDataSetChanges)
dsArcirisUsers.AcceptChanges()
Catch eUpdate As System.Exception
Throw eUpdate
End Try
End If
End Sub
Public Sub LoadDataSet()
Dim objArcirisUsersDataSetTemp As Excellence.NET.dsArcirisUsers
objArcirisUsersDataSetTemp = New Excellence.NET.dsArcirisUsers()
Try
Me.FillDataSet(objArcirisUsersDataSetTemp)
Catch eFillDataSet As System.Exception
Throw eFillDataSet
End Try
Try
dsArcirisUsers.Clear()
dsArcirisUsers.Merge(objArcirisUsersDataSetTemp)
Catch eLoadMerge As System.Exception
Throw eLoadMerge
End Try
End Sub
Public Sub UpdateDataSource(ByVal ChangedRows As dsArcirisUsers)
Try
If (Not (ChangedRows) Is Nothing) Then
Me.odcMainMenu.Open()
odaArcirisUsers.Update(ChangedRows)
odaSites.Update(ChangedRows)
End If
Catch updateException As System.Exception
Throw updateException
Finally
Me.odcMainMenu.Close()
End Try
End Sub
Public Sub FillDataSet(ByVal dataSet As Excellence.NET.dsArcirisUsers)
dataSet.EnforceConstraints = False
Try
Me.odcMainMenu.Open()
Me.odaArcirisUsers.Fill(dataSet)
Me.odaSites.Fill(dataSet)
Catch fillException As System.Exception
Throw fillException
Finally
dataSet.EnforceConstraints = True
Me.odcMainMenu.Close()
End Try
End Sub
Many Thanks
MCN
Could sombody possibly have a look at the following code for me please?
It all works fine but when I click on the btnUpdate_Click, after making
changes to the data, it just seems to load the old Dataset again, I checked
mydatabase and no of the changes had taken effect in there?
Im pretty should its something nice and simple I jut carn`t se what
Heres the Code:
Private Sub btnUpdate_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnUpdate.Click
Try
Me.UpdateDataSet()
Catch eUpdate As System.Exception
System.Windows.Forms.MessageBox.Show(eUpdate.Message)
End Try
Me.dsArcirisUsers_PositionChanged()
End Sub
Private Sub btnLoad_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnLoad.Click
Try
mlLoading = True
Me.LoadDataSet()
Catch eLoad As System.Exception
System.Windows.Forms.MessageBox.Show(eLoad.Message)
Finally
mlLoading = False
End Try
Me.dsArcirisUsers_PositionChanged()
End Sub
Private Sub dsArcirisUsers_PositionChanged()
If Me.BindingContext(dsArcirisUsers, "ArcirisUsers").Position <> -1
Then
Me.cboArcirisUsersPrimarySite.SelectedValue =
dsArcirisUsers.ArcirisUsers.Rows(Me.BindingContext(dsArcirisUsers,
"ArcirisUsers").Position).Item("SitesID")
End If
Me.lblNavLocation.Text = (((Me.BindingContext(dsArcirisUsers,
"ArcirisUsers").Position + 1).ToString + " of ") +
Me.BindingContext(dsArcirisUsers, "ArcirisUsers").Count.ToString)
End Sub
Public Sub UpdateDataSet()
Dim objArcirisUsersDataSetChanges As Excellence.NET.dsArcirisUsers =
New Excellence.NET.dsArcirisUsers()
Me.BindingContext(dsArcirisUsers, "ArcirisUsers").EndCurrentEdit()
objArcirisUsersDataSetChanges = CType(dsArcirisUsers.GetChanges,
Excellence.NET.dsArcirisUsers)
If (Not (objArcirisUsersDataSetChanges) Is Nothing) Then
Try
Me.UpdateDataSource(objArcirisUsersDataSetChanges)
dsArcirisUsers.Merge(objArcirisUsersDataSetChanges)
dsArcirisUsers.AcceptChanges()
Catch eUpdate As System.Exception
Throw eUpdate
End Try
End If
End Sub
Public Sub LoadDataSet()
Dim objArcirisUsersDataSetTemp As Excellence.NET.dsArcirisUsers
objArcirisUsersDataSetTemp = New Excellence.NET.dsArcirisUsers()
Try
Me.FillDataSet(objArcirisUsersDataSetTemp)
Catch eFillDataSet As System.Exception
Throw eFillDataSet
End Try
Try
dsArcirisUsers.Clear()
dsArcirisUsers.Merge(objArcirisUsersDataSetTemp)
Catch eLoadMerge As System.Exception
Throw eLoadMerge
End Try
End Sub
Public Sub UpdateDataSource(ByVal ChangedRows As dsArcirisUsers)
Try
If (Not (ChangedRows) Is Nothing) Then
Me.odcMainMenu.Open()
odaArcirisUsers.Update(ChangedRows)
odaSites.Update(ChangedRows)
End If
Catch updateException As System.Exception
Throw updateException
Finally
Me.odcMainMenu.Close()
End Try
End Sub
Public Sub FillDataSet(ByVal dataSet As Excellence.NET.dsArcirisUsers)
dataSet.EnforceConstraints = False
Try
Me.odcMainMenu.Open()
Me.odaArcirisUsers.Fill(dataSet)
Me.odaSites.Fill(dataSet)
Catch fillException As System.Exception
Throw fillException
Finally
dataSet.EnforceConstraints = True
Me.odcMainMenu.Close()
End Try
End Sub
Many Thanks
MCN