By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,594 Members | 2,016 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,594 IT Pros & Developers. It's quick & easy.

Save routing not working

P: 4
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
Share this question for a faster answer!
Share on Google+

Post your reply

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