S
Stephen Plotnick
I have two events in the same program that executes the same sub rountine;
one is from a menu item the other is from a button.
THe button works perfectly and the menu item does not. See the code here.
From within the debugger the myDS.HasChanges allows the update to occur from
the button and the myDS.HasChanges does not allow the update to occur; as if
there are not any changes.
I am definetly doing changes in both instances.
THanks,
Steve
___________________________________
Exit button on form
___________________________________
Private Sub ExitButton_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles ExitButton.Click
Update_Check_Rtn()
Application.Exit()
End Sub
_____________________________________________
Menu item
___________________________________________
Private Sub MenuItem3_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MenuItem3.Click
Update_Check_Rtn()
Application.Exit()
End Sub
________________________________________
Routine called
_______________________________________
Private Sub Update_Check_Rtn()
Dim ExitResponce As Integer
If myDS.HasChanges Then
ExitResponce = MsgBox("Do you want to save your changes?", vbYesNo)
If ExitResponce = vbYes Then
Dim conn As New
System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data
source='C:\Program Files\MyArea\Pricing\Pricing.mdb';Persist Security
Info=False")
Dim uSql = "Select * from ProductNames"
da.SelectCommand = New OleDb.OleDbCommand(uSql, conn)
Dim cb As New OleDb.OleDbCommandBuilder(da)
Try
myDS.Tables("ProductNames").GetChanges()
da.Update(myDS.Tables("ProductNames"))
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
End If
End If
End Sub
one is from a menu item the other is from a button.
THe button works perfectly and the menu item does not. See the code here.
From within the debugger the myDS.HasChanges allows the update to occur from
the button and the myDS.HasChanges does not allow the update to occur; as if
there are not any changes.
I am definetly doing changes in both instances.
THanks,
Steve
___________________________________
Exit button on form
___________________________________
Private Sub ExitButton_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles ExitButton.Click
Update_Check_Rtn()
Application.Exit()
End Sub
_____________________________________________
Menu item
___________________________________________
Private Sub MenuItem3_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MenuItem3.Click
Update_Check_Rtn()
Application.Exit()
End Sub
________________________________________
Routine called
_______________________________________
Private Sub Update_Check_Rtn()
Dim ExitResponce As Integer
If myDS.HasChanges Then
ExitResponce = MsgBox("Do you want to save your changes?", vbYesNo)
If ExitResponce = vbYes Then
Dim conn As New
System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data
source='C:\Program Files\MyArea\Pricing\Pricing.mdb';Persist Security
Info=False")
Dim uSql = "Select * from ProductNames"
da.SelectCommand = New OleDb.OleDbCommand(uSql, conn)
Dim cb As New OleDb.OleDbCommandBuilder(da)
Try
myDS.Tables("ProductNames").GetChanges()
da.Update(myDS.Tables("ProductNames"))
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
End If
End If
End Sub