Does a menu item lose dataset information?

  • Thread starter Stephen Plotnick
  • Start date
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
 
C

Cor Ligthert [MVP]

Stephen,

No a menu item does nothing with a dataset, why do you not debug your
program?

Cor
 
S

Stephen Plotnick

I did debug it that is how I know that the changed status is incorrect from
within the menu option. Does MS know of a bug with this situation?

Steve
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top