467,151 Members | 900 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,151 developers. It's quick & easy.

Save routing not working

Hi Everybody,

I am writing an application using the bindingnavigator and the oledbDataAdapter. I am not able to save the changes to the actual access database. Please help me. The code follows.

Thank you

I have opened a connection and the following code binds the database with the bindingnavigator using a oledbDataAdapter. And also to the text box. Where we can edit the fields and later on save them.

Expand|Select|Wrap|Line Numbers
  1. Me.objDataAdapter = New OleDbDataAdapter("Select * from datatable", Me.objConnection)
  3.         Me.objDataAdapter.Fill(Me.objDataTable)
  5.         Me.BindingSource1.DataSource = Me.objDataTable
  6.         Me.BindingNavigator1.BindingSource = Me.BindingSource1
  7.         Me.BindingNavigator1.Dock = DockStyle.None
  8.         Me.Controls.Add(Me.BindingNavigator1)
  10.         Me.Controls.Add(Me.RichTextBox1)
  11.         Me.RichTextBox1.DataBindings.Add(New Binding("Text", Me.BindingSource1, "audit_task_no", True))

The following is the save routine.

Expand|Select|Wrap|Line Numbers
  1.         Try
  2.             Me.objDataAdapter.Update(Me.objDataTable)
  3.             MsgBox("Changes Successful Saved ")
  4.         Catch ex As Exception
  5.             MsgBox("Saved Failed")
  6.         End Try
  8.         Try
  9.             Me.objDataTable.AcceptChanges()
  10.         Catch ex As Exception
  11.             MsgBox("Update failed")
  12.         End Try
I have declared objDataAdapter and other variables gloable thats why I am using Me.objDataAdapter.
Nov 25 '06 #1
  • viewed: 910

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by Shiv Agarwal | last post: by
1 post views Thread by Tom Weston | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.