471,310 Members | 1,380 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

dataset.ApplyChanges() not taking effect.

Here is my code.

Does anyone know why when i reopen the table to view the data, none of the
rows have been written?

DownloadFileDataSet.DownloadFileRow MainTableRow =
(DownloadFileDataSet.DownloadFileRow)downloadFileD ataSet.DownloadFile.NewRow();
MainTableRow.Date = DateTime.Now;
MainTableRow.RowID = gDownloadFileTableGUID;
MainTableRow.FileName = sFileName;
MainTableRow.URL = sSource;
MainTableRow.FileSize = iFileLength.ToString();
downloadFileDataSet.DownloadFile.AddDownloadFileRo w(MainTableRow);

//Save the dataset to the database
downloadFileDataSet.AcceptChanges();
Jul 21 '08 #1
3 1852
* * * * * * //Save the dataset to the database
* * * * * * downloadFileDataSet.AcceptChanges();
IIRC AcceptChanges do not save the changes to the DB, only to the
dataset in memory
Jul 21 '08 #2
How do i save the changes to the DB?

"Ignacio Machin ( .NET/ C# MVP )" wrote:
>
//Save the dataset to the database
downloadFileDataSet.AcceptChanges();

IIRC AcceptChanges do not save the changes to the DB, only to the
dataset in memory
Jul 21 '08 #3
On Mon, 21 Jul 2008 13:28:16 -0700, greatbarrier86 wrote:
How do i save the changes to the DB?
I had exactly the same problem ended up with:

internal void UpdateDatabase()
{
EndEditOnAllBindingSources();

tableAdapterManager.UpdateAll(scoreDataset);

}
private void EndEditOnAllBindingSources()
{
var BindingSourcesQuery =
from Component bindingSources in
this.components.Components
where bindingSources is BindingSource
select bindingSources;

foreach (BindingSource bindingSource in BindingSourcesQuery)
{
bindingSource.EndEdit();
}
}

Jul 22 '08 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Chris | last post: by
22 posts views Thread by Arne | last post: by
3 posts views Thread by Imran Aziz | last post: by
3 posts views Thread by tshad | last post: by
reply views Thread by rosydwin | last post: by

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.