473,659 Members | 3,475 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Save data doesn't work

Hello!

I'm using VS2005.
I'm looking at ADO.NET and have found some test tutorial solution on
microsoft MSDN.
The one that I'm looking at now is called Walkthrough: Saving Data to a
Database (Single Table)

I have followed the walkthrought exectly but it doesn't work as expected.

I have a Data Source with one database table.
The table is from the northwind database and is called customer.
This table is set to be in Detail mode meaning I get individuals control for
the whole table when I drag the table into the windows form.

In this form there is a diskett meaning that I can save data back to the
database.

So I do the following change some data in one of the control and then click
the diskett symbol meaning I save the data back to the database.
If I now go to the next record and then go back to the previous record the
change is there.
So I manage to change in the dataset but if I then close the application and
look in the database my changes has not changed anything in the database.

I can't understand why this doesn't work.
//Tony
Oct 22 '07 #1
1 2608
Hello!!

Below is the event handler that is called when I click the diskett save
icon.
The text that is printed is Update successful so I don't get any errors but
as I mentioned no update is done to the
database.
private void customersBindin gNavigatorSaveI tem_Click(objec t sender,
EventArgs e)
{
try
{
this.Validate() ;
this.customersB indingSource.En dEdit();
this.customersT ableAdapter.Upd ate(this.nwindD ataSet.Customer s);
MessageBox.Show ("Update successful");
}
catch (System.Excepti on ex)
{
MessageBox.Show ("Update failed");
}
}

"TonyJ" <jo************ *****@telia.com skrev i meddelandet
news:%2******** **********@TK2M SFTNGP02.phx.gb l...
Hello!

I'm using VS2005.
I'm looking at ADO.NET and have found some test tutorial solution on
microsoft MSDN.
The one that I'm looking at now is called Walkthrough: Saving Data to a
Database (Single Table)

I have followed the walkthrought exectly but it doesn't work as expected.

I have a Data Source with one database table.
The table is from the northwind database and is called customer.
This table is set to be in Detail mode meaning I get individuals control
for
the whole table when I drag the table into the windows form.

In this form there is a diskett meaning that I can save data back to the
database.

So I do the following change some data in one of the control and then
click
the diskett symbol meaning I save the data back to the database.
If I now go to the next record and then go back to the previous record the
change is there.
So I manage to change in the dataset but if I then close the application
and
look in the database my changes has not changed anything in the database.

I can't understand why this doesn't work.
//Tony


Oct 22 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
2639
by: Mark Johnson | last post by:
How can you save all or a portion of the Grafics object to a Image/Bitmap ? I am try to save the Images from Cards.dll to a BitMap file. I can read in the Images to the Grafics, but when I try this with a Bitmap the results are Black. Can you somehow Clip the Grafic and Paste it into the Bitmap ? Mark Johnson, Berlin Germany mj10777@mj10777.de
22
5027
by: Br | last post by:
First issue: When using ADPs you no longer have the ability to issue a me.refresh to save the current record on a form (the me.refresh does a requery in an ADP). We usually do this before calling up another form or report that uses some of the same data. We came up with a work around that saves the current record's ID, does a
10
39481
by: Henok Girma | last post by:
Hello Gurus, I want to save the state of an unbound DataGridView on my Windows Form application to an XML file so i can later load it back.. Basically, on my form I have a DataGridView, it's got some DataGridViewTextBoxCell, DataGridViewComboBoxCell etc, i want to export all that to XML.. Any help is greatly appreciated.
2
1666
by: mast2as | last post by:
Hi there, for a long time I've been trying to think of way of saving different data of different types using one single class (well 2 in reality, a class for the data, and 1 class for a list of data). The problem that I try to solve is the following. Imagine a class "Attribute" that needs to save multiple "Parameters" (the number of parameters for 1 attribute will vary each time we run the application). Each parameter can be of a different...
1
6803
by: liuliuliu | last post by:
hi -- sorry if this is trivial -- but how do you make a screenshot of a pygame display? i have a surface which is basically the entire visible screen -- how do you write this surface as an image file during specific events in the script execution? image format doesnt matter. thanks! christine
6
4137
by: Josetta | last post by:
Access 2003 I've been experiencing some problems with my "monster" database the last couple of days. I imported all objects into a new database yesterday, which pretty much stopped the crashing problems, but here's something weird: Whenever I copy an object (reports so far), I am able to open it and make changes, but when I try to save it (without closing), it appears to save (message box goes off), but it doesn't. Then, if I try to...
6
4119
by: Joe Kovac | last post by:
Hi! I change quite a lot TableRows in several Tables of a typed DataSet. Now I would like to know which is the best way to save all the rows. Currently I just use each TableAdapters Update() method. First, I think I should have some kind of transactions. Secondly, I think I should use GetChanges()? Where can I get more informations on how to save the data best? Most
1
6107
by: QCLee | last post by:
Hello Sir, Im here again asking for help. I have a form and a subform relate to HVAC Windward Table. i have a SAVE button on the form that when clicked it saves data on the HVAC Windward Table but not in a subform. When manually inputing data into subform it saves by work order on the HVAC Windward Table in subdatasheet even if how many times i add data in one work order. Sir, Is it posible that when i clicked on the SAVE button in the form it...
5
2103
by: terrybell105 | last post by:
I downloaded Stephan's utility from his website but can't get it to work - or maybe I'm not driving it properly! The form works OK with the existing 3 "views" - I can switch between them and they display changes fine. But if I add or remove a table from any one of them, strange things happen. For example: start with a fresh copy of the downloaded database. Open the form and click on the "Admin" view. Right click and click on "Show Table"...
0
8428
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8337
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8851
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8748
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7359
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6181
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5650
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4335
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1978
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.