|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Saving changes to a databasedatabase. The table I'm trying to update has a key field. When I click the Save Button the update seems to work in the dataset, but the database is not updated. The code I'm using for the btnSave is: Private Sub btnSave_Click(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles btnSave.Click 'saves adds and edits to database If bChange = False Then MsgBox("Nothing To Save", MsgBoxStyle.OkOnly, "Test!!!!") Else Me.Validate() Me.TblCompanyBindingSource.EndEdit() Me.TblCompanyTableAdapter.Update(Me.DsCompData.tblCoompany) bChange = False End If Me.DisplayPosition() 'reset record location Me.setMaintenceButtons(True) End Sub Any suggestiona dn help is greatly appreciated!!!! -- Tony Tony,
Are you sure that this is your code. Because it seems if you are using two different tables. Cor Show quoteHide quote "Tony A." <To***@discussions.microsoft.com> schreef in bericht news:E907AFE6-BAE3-4995-92A9-6E330CDC7819@microsoft.com... > I'm working on an application using VB .Net 2005 and MS Access 2003 for > the > database. The table I'm trying to update has a key field. When I click > the > Save Button the update seems to work in the dataset, but the database is > not > updated. The code I'm using for the btnSave is: > > Private Sub btnSave_Click(ByVal sender As System.Object, _ > ByVal e As System.EventArgs) Handles btnSave.Click > > 'saves adds and edits to database > If bChange = False Then > MsgBox("Nothing To Save", MsgBoxStyle.OkOnly, "Test!!!!") > Else > Me.Validate() > Me.TblCompanyBindingSource.EndEdit() > Me.TblCompanyTableAdapter.Update(Me.DsCompData.tblCoompany) > bChange = False > End If > > Me.DisplayPosition() 'reset record location > Me.setMaintenceButtons(True) > > End Sub > > Any suggestiona dn help is greatly appreciated!!!! > > -- > Tony I see where tblCoompany was misspelled. Should have been tblCompany. It is
correct in the application. Thanks. Other suggestions?? -- Show quoteHide quoteTony "Cor Ligthert [MVP]" wrote: > Tony, > > Are you sure that this is your code. Because it seems if you are using two > different tables. > > Cor > > "Tony A." <To***@discussions.microsoft.com> schreef in bericht > news:E907AFE6-BAE3-4995-92A9-6E330CDC7819@microsoft.com... > > I'm working on an application using VB .Net 2005 and MS Access 2003 for > > the > > database. The table I'm trying to update has a key field. When I click > > the > > Save Button the update seems to work in the dataset, but the database is > > not > > updated. The code I'm using for the btnSave is: > > > > Private Sub btnSave_Click(ByVal sender As System.Object, _ > > ByVal e As System.EventArgs) Handles btnSave.Click > > > > 'saves adds and edits to database > > If bChange = False Then > > MsgBox("Nothing To Save", MsgBoxStyle.OkOnly, "Test!!!!") > > Else > > Me.Validate() > > Me.TblCompanyBindingSource.EndEdit() > > Me.TblCompanyTableAdapter.Update(Me.DsCompData.tblCoompany) > > bChange = False > > End If > > > > Me.DisplayPosition() 'reset record location > > Me.setMaintenceButtons(True) > > > > End Sub > > > > Any suggestiona dn help is greatly appreciated!!!! > > > > -- > > Tony > > > What is bchange and when is it getting changed? Are you sure the
tableadapter is firing the update event? -- Show quoteHide quote--ewok MCSA+M,MCSE, MCSD, MCDBA,MCITP "Tony A." wrote: > I see where tblCoompany was misspelled. Should have been tblCompany. It is > correct in the application. Thanks. Other suggestions?? > -- > Tony > > > "Cor Ligthert [MVP]" wrote: > > > Tony, > > > > Are you sure that this is your code. Because it seems if you are using two > > different tables. > > > > Cor > > > > "Tony A." <To***@discussions.microsoft.com> schreef in bericht > > news:E907AFE6-BAE3-4995-92A9-6E330CDC7819@microsoft.com... > > > I'm working on an application using VB .Net 2005 and MS Access 2003 for > > > the > > > database. The table I'm trying to update has a key field. When I click > > > the > > > Save Button the update seems to work in the dataset, but the database is > > > not > > > updated. The code I'm using for the btnSave is: > > > > > > Private Sub btnSave_Click(ByVal sender As System.Object, _ > > > ByVal e As System.EventArgs) Handles btnSave.Click > > > > > > 'saves adds and edits to database > > > If bChange = False Then > > > MsgBox("Nothing To Save", MsgBoxStyle.OkOnly, "Test!!!!") > > > Else > > > Me.Validate() > > > Me.TblCompanyBindingSource.EndEdit() > > > Me.TblCompanyTableAdapter.Update(Me.DsCompData.tblCoompany) > > > bChange = False > > > End If > > > > > > Me.DisplayPosition() 'reset record location > > > Me.setMaintenceButtons(True) > > > > > > End Sub > > > > > > Any suggestiona dn help is greatly appreciated!!!! > > > > > > -- > > > Tony > > > > > > I have a procedure that checks to see if the value in any of the text boxes
or combo box has changed = bchange The program crashes at the TableAdapter.Update line. This error appears: Update requires a valid UpdateCommand when passed DataRow collection with modified rows. -- Show quoteHide quoteTony "ewok66" wrote: > What is bchange and when is it getting changed? Are you sure the > tableadapter is firing the update event? > -- > --ewok > MCSA+M,MCSE, MCSD, MCDBA,MCITP > > > "Tony A." wrote: > > > I see where tblCoompany was misspelled. Should have been tblCompany. It is > > correct in the application. Thanks. Other suggestions?? > > -- > > Tony > > > > > > "Cor Ligthert [MVP]" wrote: > > > > > Tony, > > > > > > Are you sure that this is your code. Because it seems if you are using two > > > different tables. > > > > > > Cor > > > > > > "Tony A." <To***@discussions.microsoft.com> schreef in bericht > > > news:E907AFE6-BAE3-4995-92A9-6E330CDC7819@microsoft.com... > > > > I'm working on an application using VB .Net 2005 and MS Access 2003 for > > > > the > > > > database. The table I'm trying to update has a key field. When I click > > > > the > > > > Save Button the update seems to work in the dataset, but the database is > > > > not > > > > updated. The code I'm using for the btnSave is: > > > > > > > > Private Sub btnSave_Click(ByVal sender As System.Object, _ > > > > ByVal e As System.EventArgs) Handles btnSave.Click > > > > > > > > 'saves adds and edits to database > > > > If bChange = False Then > > > > MsgBox("Nothing To Save", MsgBoxStyle.OkOnly, "Test!!!!") > > > > Else > > > > Me.Validate() > > > > Me.TblCompanyBindingSource.EndEdit() > > > > Me.TblCompanyTableAdapter.Update(Me.DsCompData.tblCoompany) > > > > bChange = False > > > > End If > > > > > > > > Me.DisplayPosition() 'reset record location > > > > Me.setMaintenceButtons(True) > > > > > > > > End Sub > > > > > > > > Any suggestiona dn help is greatly appreciated!!!! > > > > > > > > -- > > > > Tony > > > > > > > > > Sounds like you need an update statement - did you remove it at some point
from your data adapter? If you use a wizard to automatically add one, ensure part of the update statement doesn't try and update your key field. -- Show quoteHide quote--ewok MCSA+M,MCSE, MCSD, MCDBA,MCITP "Tony A." wrote: > I have a procedure that checks to see if the value in any of the text boxes > or combo box has changed = bchange > > The program crashes at the TableAdapter.Update line. This error appears: > > Update requires a valid UpdateCommand when passed DataRow collection with > modified rows. > > > -- > Tony > > > "ewok66" wrote: > > > What is bchange and when is it getting changed? Are you sure the > > tableadapter is firing the update event? > > -- > > --ewok > > MCSA+M,MCSE, MCSD, MCDBA,MCITP > > > > > > "Tony A." wrote: > > > > > I see where tblCoompany was misspelled. Should have been tblCompany. It is > > > correct in the application. Thanks. Other suggestions?? > > > -- > > > Tony > > > > > > > > > "Cor Ligthert [MVP]" wrote: > > > > > > > Tony, > > > > > > > > Are you sure that this is your code. Because it seems if you are using two > > > > different tables. > > > > > > > > Cor > > > > > > > > "Tony A." <To***@discussions.microsoft.com> schreef in bericht > > > > news:E907AFE6-BAE3-4995-92A9-6E330CDC7819@microsoft.com... > > > > > I'm working on an application using VB .Net 2005 and MS Access 2003 for > > > > > the > > > > > database. The table I'm trying to update has a key field. When I click > > > > > the > > > > > Save Button the update seems to work in the dataset, but the database is > > > > > not > > > > > updated. The code I'm using for the btnSave is: > > > > > > > > > > Private Sub btnSave_Click(ByVal sender As System.Object, _ > > > > > ByVal e As System.EventArgs) Handles btnSave.Click > > > > > > > > > > 'saves adds and edits to database > > > > > If bChange = False Then > > > > > MsgBox("Nothing To Save", MsgBoxStyle.OkOnly, "Test!!!!") > > > > > Else > > > > > Me.Validate() > > > > > Me.TblCompanyBindingSource.EndEdit() > > > > > Me.TblCompanyTableAdapter.Update(Me.DsCompData.tblCoompany) > > > > > bChange = False > > > > > End If > > > > > > > > > > Me.DisplayPosition() 'reset record location > > > > > Me.setMaintenceButtons(True) > > > > > > > > > > End Sub > > > > > > > > > > Any suggestiona dn help is greatly appreciated!!!! > > > > > > > > > > -- > > > > > Tony > > > > > > > > > > > > Thank you.
-- Show quoteHide quoteTony "ewok66" wrote: > Sounds like you need an update statement - did you remove it at some point > from your data adapter? If you use a wizard to automatically add one, ensure > part of the update statement doesn't try and update your key field. > -- > --ewok > MCSA+M,MCSE, MCSD, MCDBA,MCITP > > > "Tony A." wrote: > > > I have a procedure that checks to see if the value in any of the text boxes > > or combo box has changed = bchange > > > > The program crashes at the TableAdapter.Update line. This error appears: > > > > Update requires a valid UpdateCommand when passed DataRow collection with > > modified rows. > > > > > > -- > > Tony > > > > > > "ewok66" wrote: > > > > > What is bchange and when is it getting changed? Are you sure the > > > tableadapter is firing the update event? > > > -- > > > --ewok > > > MCSA+M,MCSE, MCSD, MCDBA,MCITP > > > > > > > > > "Tony A." wrote: > > > > > > > I see where tblCoompany was misspelled. Should have been tblCompany. It is > > > > correct in the application. Thanks. Other suggestions?? > > > > -- > > > > Tony > > > > > > > > > > > > "Cor Ligthert [MVP]" wrote: > > > > > > > > > Tony, > > > > > > > > > > Are you sure that this is your code. Because it seems if you are using two > > > > > different tables. > > > > > > > > > > Cor > > > > > > > > > > "Tony A." <To***@discussions.microsoft.com> schreef in bericht > > > > > news:E907AFE6-BAE3-4995-92A9-6E330CDC7819@microsoft.com... > > > > > > I'm working on an application using VB .Net 2005 and MS Access 2003 for > > > > > > the > > > > > > database. The table I'm trying to update has a key field. When I click > > > > > > the > > > > > > Save Button the update seems to work in the dataset, but the database is > > > > > > not > > > > > > updated. The code I'm using for the btnSave is: > > > > > > > > > > > > Private Sub btnSave_Click(ByVal sender As System.Object, _ > > > > > > ByVal e As System.EventArgs) Handles btnSave.Click > > > > > > > > > > > > 'saves adds and edits to database > > > > > > If bChange = False Then > > > > > > MsgBox("Nothing To Save", MsgBoxStyle.OkOnly, "Test!!!!") > > > > > > Else > > > > > > Me.Validate() > > > > > > Me.TblCompanyBindingSource.EndEdit() > > > > > > Me.TblCompanyTableAdapter.Update(Me.DsCompData.tblCoompany) > > > > > > bChange = False > > > > > > End If > > > > > > > > > > > > Me.DisplayPosition() 'reset record location > > > > > > Me.setMaintenceButtons(True) > > > > > > > > > > > > End Sub > > > > > > > > > > > > Any suggestiona dn help is greatly appreciated!!!! > > > > > > > > > > > > -- > > > > > > Tony > > > > > > > > > > > > > > > On Tue, 30 May 2006 15:06:01 -0700, Tony A.
<To***@discussions.microsoft.com> wrote: Show quoteHide quote >I'm working on an application using VB .Net 2005 and MS Access 2003 for the In debug mode? Select the DB and change the "Copy to Output>database. The table I'm trying to update has a key field. When I click the >Save Button the update seems to work in the dataset, but the database is not >updated. The code I'm using for the btnSave is: > >Private Sub btnSave_Click(ByVal sender As System.Object, _ > ByVal e As System.EventArgs) Handles btnSave.Click > > 'saves adds and edits to database > If bChange = False Then > MsgBox("Nothing To Save", MsgBoxStyle.OkOnly, "Test!!!!") > Else > Me.Validate() > Me.TblCompanyBindingSource.EndEdit() > Me.TblCompanyTableAdapter.Update(Me.DsCompData.tblCoompany) > bChange = False > End If > > Me.DisplayPosition() 'reset record location > Me.setMaintenceButtons(True) > > End Sub > >Any suggestiona dn help is greatly appreciated!!!! Dirirectory" property to something else if it is currently set to 'Copy Always' Gene
Why choose SQL Express over Access?
Anyway To Compress PDF from .NET? Visual Basic 6.0 X Visual Basic 2005 Express Setting the correct tabindex VB.NET & SQL Server Connection Example vb.net continuation VB.NET Winforms app + MSWord (for spellcheck)? architecture question: not representing inheritance in the data model A couple of newbie questions Detect Right mouse click and key press |
|||||||||||||||||||||||