473,386 Members | 1,883 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.

Dataset X DataBase

Dears,

I have had problems to save the changes made on a form to the database. When
I call the code bellow the changes are made only at the dataset, but when I
refresh the form the data keeps unchanged.
I need this help to continue with my project. If can help I can send the
full source.

private void tbar_ButtonClick(object sender,
System.Windows.Forms.ToolBarButtonClickEventArgs e)
{
try
{
switch(tbar.Buttons.IndexOf(e.Button))
{
case 0:
try
{
int record = BindingContext[dsCliente.Tables["tbCLIENTE"]].Position;
daCliente.Update(dsCliente, "tbCLIENTE");
dsCliente.Tables["tbCLIENTE"].Rows[record].EndEdit();
dsCliente.AcceptChanges();
break;
}
catch
{
}
case 1:
//MessageBox.Show("Copiar");
break;
case 2:
//MessageBox.Show("Apagar");
break;
}
}
catch
{
MessageBox.Show("Erro ao Salvar");
}
}
}

Nov 16 '05 #1
1 1036
Verify that the dataset .HasChanges (ie Debug.Assert(dsCliente.HasChanges,
"No changes present");
http://www.knowdotnet.com/articles/efficient_pt4.html

--
W.G. Ryan MVP Windows - Embedded

Have an opinion on the effectiveness of Microsoft Embedded newsgroups?
Let Microsoft know!
https://www.windowsembeddedeval.com/...ity/newsgroups
"Rodrigo" <rb*******@hotmail.com> wrote in message
news:eq**************@tk2msftngp13.phx.gbl...
Dears,

I have had problems to save the changes made on a form to the database. When I call the code bellow the changes are made only at the dataset, but when I refresh the form the data keeps unchanged.
I need this help to continue with my project. If can help I can send the
full source.

private void tbar_ButtonClick(object sender,
System.Windows.Forms.ToolBarButtonClickEventArgs e)
{
try
{
switch(tbar.Buttons.IndexOf(e.Button))
{
case 0:
try
{
int record = BindingContext[dsCliente.Tables["tbCLIENTE"]].Position;
daCliente.Update(dsCliente, "tbCLIENTE");
dsCliente.Tables["tbCLIENTE"].Rows[record].EndEdit();
dsCliente.AcceptChanges();
break;
}
catch
{
}
case 1:
//MessageBox.Show("Copiar");
break;
case 2:
//MessageBox.Show("Apagar");
break;
}
}
catch
{
MessageBox.Show("Erro ao Salvar");
}
}
}


Nov 16 '05 #2

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

Similar topics

40
by: Peter Row | last post by:
Hi all, Here is my problem: I have a SQL Server 2000 DB with various NVarChar, NText fields in its tables. For some stupid reason the data was inserted into these fields in UTF8 encoding. ...
4
by: Frnak McKenney | last post by:
I'm using an in-core DataSet as an image of my application's 'database' (a multi-table Access97 mdb file). Updates are made to the DataTables within the DataSet via forms with bound TextBoxes,...
5
by: Grant | last post by:
Hello, How come when I add a new row to my dataset table it shows up as changed (agencyData.Haschanges() = True) but when I delete a row the dataset thinks here are no...
1
by: Mike Hnatt | last post by:
I'm baffled. My data store (database) is not updating with a refreshed dataset. Here's what is going on: 1) Create a dataset from a table in a database. 2) Create a copy of this dataset and...
1
by: Asha | last post by:
greetings, i've manually created a dataset which contains data input from users. i validate the dataset against the business logic and once everything is done, i would like to save the values in...
1
by: Arpan | last post by:
The following ASPX code snippet creates a DataSet programmatically right from the scratch: 'create an empty DataSet Dim objDS As New DataSet("MyDataSet") 'create a new table & add columns Dim...
22
by: EMW | last post by:
Hi, I managed to create a SQL server database and a table in it. The table is empty and that brings me to my next chalenge: How can I get the info in the table in the dataset to go in an empty...
2
by: Carl Summers | last post by:
I have a table in an Access database that has no sort applied in Access. When I fill a dataset with data from that table (the entire one dimensional table) my dataset is sorted differently than...
9
by: Mr Newbie | last post by:
HI People, Thanks to all who helped me earlier on the subject of @@IDentity. However, I seem to have hit another snagette! My DataSet contains two tables from the SQL Server. lets say Master...
3
by: Ken Fine | last post by:
This is a question that someone familiar with ASP.NET and ADO.NET DataSets and DataTables should be able to answer fairly easily. The basic question is how I can efficiently match data from one...
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
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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:
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.