(2005 beginner) Can't apply the changes in the DataSet to my DB.
(2005 beginner) Can't apply the changes in the DataSet to my DB.
(2005 beginner) Can't apply the changes in the DataSet to my DB.
(2005 beginner) Can't apply the changes in the DataSet to my DB.
(2005 beginner) Can't apply the changes in the DataSet to my DB.
(2005 beginner) Can't apply the changes in the DataSet to my DB. (2005 beginner) Can't apply the changes in the DataSet to my DB. (2005 beginner) Can't apply the changes in the DataSet to my DB. (2005 beginner) Can't apply the changes in the DataSet to my DB. (2005 beginner) Can't apply the changes in the DataSet to my DB. (2005 beginner) Can't apply the changes in the DataSet to my DB. (2005 beginner) Can't apply the changes in the DataSet to my DB. (2005 beginner) Can't apply the changes in the DataSet to my DB.
(2005 beginner) Can't apply the changes in the DataSet to my DB. (2005 beginner) Can't apply the changes in the DataSet to my DB.
(2005 beginner) Can't apply the changes in the DataSet to my DB.
Go Back  Xtreme Visual Basic Talk > > > (2005 beginner) Can't apply the changes in the DataSet to my DB.


Reply
 
Thread Tools Display Modes
  #1  
Old 04-20-2007, 03:36 PM
javad2000 javad2000 is offline
Regular
 
Join Date: Jan 2007
Posts: 54
Default (2005 beginner) Can't apply the changes in the DataSet to my DB.


Hello

I have created a DataSet which is connected to an Access DB. This is exactly what I have in my program:
http://imgplace.com/directory/dir159...04409_2518.JPG

I can easily Add/Delete/Edit the data in my DS using the NavigatorBar's buttons, but when I click on "Save" butto (I mean the "Floppy" icon at the top of the form), exit the app. and run it again, I see that none of the changes have been applied and everything's like what it was before editting.

How can I apply the DS changes to the DB?

Thank you
Reply With Quote
  #2  
Old 04-21-2007, 02:46 AM
javad2000 javad2000 is offline
Regular
 
Join Date: Jan 2007
Posts: 54
Default

no answer?
Reply With Quote
  #3  
Old 04-21-2007, 08:13 AM
javad2000 javad2000 is offline
Regular
 
Join Date: Jan 2007
Posts: 54
Default

I used this code to update my DB, but neither it worked nor gave me an error. Only give me "Update Successful" message, but when I check it again, I see no updates have been applied. Plz HLP.


Try
Me.Validate()
Me.TblContactsBindingSource.EndEdit()
Me.TblContactsTableAdapter.Update(Me.AddressBookDataSet.tblContacts)
MsgBox("Update successful")

Catch ex As Exception
MsgBox("Update failed")
End Try

Last edited by javad2000; 04-21-2007 at 08:19 AM.
Reply With Quote
  #4  
Old 04-21-2007, 10:14 AM
MKoslof's Avatar
MKoslof(2005 beginner) Can't apply the changes in the DataSet to my DB. MKoslof is offline
Cum Grano Salis

Retired Moderator
* Guru *
 
Join Date: Jul 2002
Location: Baltimore, Maryland
Posts: 14,636
Default

Can you show us the code where you actually make changes to the DataSet/DataTable? In your try block you validate the form, which will do control validation and call .EndEdit()...but where are the values within the DataSet/DataTable updated or modified?
__________________
"Artificial Intelligence is no match for natural stupidity." ~unknown
Reply With Quote
  #5  
Old 04-21-2007, 03:03 PM
javad2000 javad2000 is offline
Regular
 
Join Date: Jan 2007
Posts: 54
Default

I don't know what "Validation" and "EndEdit" do! I got the code fromVB help (for updating the data of a DS to a DB) and only changed the names of TableAdapter, DataSet, etc.

I don't use any code for add/delete/edit my data in the dataset, because the VB's NavigatorBar (as you see in the picture (post 1)) does it all for me (There's no code behind its buttons' click-events) and they work fine, until I exit the app, and everything remains unchanged.

What should I do?
Thanx
Reply With Quote
  #6  
Old 04-21-2007, 07:57 PM
tbird tbird is offline
Newcomer
 
Join Date: Apr 2004
Posts: 4
Default

Not sure if this is your answer but take a look.
http://blogs.msdn.com/smartclientdat...26/456886.aspx
Reply With Quote
  #7  
Old 04-22-2007, 05:00 AM
javad2000 javad2000 is offline
Regular
 
Join Date: Jan 2007
Posts: 54
Default

Thank you tbird. My answer existed in the link. and my prob. is solved now. Here it is (see the "Bold" line):

Quote:
At design-time, MyProject\Data.mdf is used by the data tools. At run-time, the app will be using the database under the output folder. As a result of the copy, many people have the impression that the app did not save the data to the database file. In fact, this is simply because there are two copies of the data file involved. Same applies when looking at the schema/data through the database explorer. The tools are using the copy in the project, not the one in the bin folder.


If this copy behavior is not what you want, there are few ways to work around it:

1. If you select local database file in the Solution Explorer window, you will see a property called ‘Copy to Output’ in the Properties window. By default it is set to ‘Copy Always’ which means that on each build, the data files in the project folder will be copied to the output folder overwriting the existing data files if any. You can set this property to Copy Never and then manually put a copy of the data file in the output folder. This way, on subsequent builds, the project system will leave the datafile in the output folder and not try to overwrite it with the one from the project. The downside is that you still have two copies so after you modify the database file using the app, if you want to work on those changes in the project, you need to copy it to the project manually and vise-versa.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
(2005 beginner) Can't apply the changes in the DataSet to my DB.
(2005 beginner) Can't apply the changes in the DataSet to my DB.
(2005 beginner) Can't apply the changes in the DataSet to my DB. (2005 beginner) Can't apply the changes in the DataSet to my DB.
(2005 beginner) Can't apply the changes in the DataSet to my DB.
(2005 beginner) Can't apply the changes in the DataSet to my DB.
(2005 beginner) Can't apply the changes in the DataSet to my DB. (2005 beginner) Can't apply the changes in the DataSet to my DB. (2005 beginner) Can't apply the changes in the DataSet to my DB. (2005 beginner) Can't apply the changes in the DataSet to my DB. (2005 beginner) Can't apply the changes in the DataSet to my DB. (2005 beginner) Can't apply the changes in the DataSet to my DB. (2005 beginner) Can't apply the changes in the DataSet to my DB.
(2005 beginner) Can't apply the changes in the DataSet to my DB.
(2005 beginner) Can't apply the changes in the DataSet to my DB.
 
(2005 beginner) Can't apply the changes in the DataSet to my DB.
(2005 beginner) Can't apply the changes in the DataSet to my DB.
 
-->