473,386 Members | 1,721 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Save routine 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
Vishal



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)
  2.  
  3.         Me.objDataAdapter.Fill(Me.objDataTable)
  4.  
  5.         Me.BindingSource1.DataSource = Me.objDataTable
  6.         Me.BindingNavigator1.BindingSource = Me.BindingSource1
  7.         Me.BindingNavigator1.Dock = DockStyle.None
  8.         Me.Controls.Add(Me.BindingNavigator1)
  9.  
  10.         Me.Controls.Add(Me.RichTextBox1)
  11.         Me.RichTextBox1.DataBindings.Add(New Binding("Text", Me.BindingSource1, "audit_task_no", True)) 
  12.  

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
  7.  
  8.         Try
  9.             Me.objDataTable.AcceptChanges()
  10.         Catch ex As Exception
  11.             MsgBox("Update failed")
  12.         End Try 
  13.  
I have declared objDataAdapter and other variables gloable thats why I am using Me.objDataAdapter.
Nov 25 '06 #1
1 1504
What do I mean when I say that I am not able to save the changes?
I mean that they are not reflected in the database when I reopen it.

Does an error occur?
No error occurs.

If not then how am I determining that the save operation didn't work?
No changes are reflected in the database.

What value does Update return?
It returns zero.

So, there might be a problem with the update function.

I am binding the richtext box with the bindingsource. And the bindingsource is the datatable. Are the values in the datatable automatically updates when I change a value in the richtext box? If not how can I do that.


Any kind of suggestion would be highly appreciated.
Thanking you in anticipation.
vishal
Nov 26 '06 #2

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

Similar topics

8
by: Pavan Arise | last post by:
Dear all.. I have a picturebox filled on a form. The picturebox has some graphics displayed on it.I was trying to save the picturebox, but continuesly failed to do so. I am clueless of why it is...
4
by: Andras Gilicz | last post by:
Hi VB fans I'm working on a relatively large project in VB6 with about a dozen forms, including graphs, labels, text boxes, etc. The software itself is actually a flow simulator with more or...
11
by: deko | last post by:
I need to create different recordsets based on queries that use data from unbound fields in a form. I've discovered that I can't do this, and instead need to save the data in question (usually a...
2
by: NATO24 | last post by:
Hello, I am trying to write a sub routine that I can pass a posted (image) file to. That routine will save the original file, then create a thumbnail and save it. When I try to create the image...
10
by: GJP | last post by:
Hello. Ive been asked to make my own notepade for college assignment. All ig going well, but i cant get the save to work. I can get Save a (shows dialog box), i can get it to just save too,...
6
by: Ryan | last post by:
I have a windows form that I want to force validation on controls (text boxes) when the user clicks a "Save" button. The only way I've found to do this is to cycle through every control and call...
0
by: vishalsangwan | last post by:
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. ...
1
by: =?Utf-8?B?U2hhdw==?= | last post by:
I have a small GridView about max 10 rows and few columns. The columns are simple just a checkbox and a textbox and a bound name. The users don’t want to click “edit” button to edit and...
3
by: evenlater | last post by:
I have an Access application on a terminal server. Sometimes my users need to export reports to pdf, rtf or xls files and save them to their own client device hard drives. They can do that right...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.