473,246 Members | 1,422 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,246 software developers and data experts.

DatasetCounter - DataGridView Problem - VS2005, C#

Hello,

I have one problem.
Include my project is a dataset with tables.
During my process I create a new temporary table.

The dataset use my DataGrid Control.

The use delete now one, two or more rows.
After that the operator press <saveand I create the new table with
some Reference,
from the table, which the operator deleted.

I go through the table and I see all deleted rows.
Why?
What can I do?
I need not Transmit and Rollback...

If the operator deletes the lines, these are to be deleted.

dataSetDatabase.Query ?? it does not give
dataSetDatabase.ReQuery ?? it does not give
dataSetDatabase.Update ?? it does not give

I need AccepteChanges, yes or no?

A bad solution is that.
My attempt.
dataSetDatabase.tblSequence.Clear();
dataSetDatabase.WriteXml( filename );

dataSetDatabase.Clear();
dataSetDatabase.ReadXml( filename );
create the new table.
Can everybody help me?
Thanks for help.
Regards,
Andrea
Jul 9 '08 #1
6 1889
You need to be a little clearer with your question.
Are you saying that the user deletes rows from your dataset through a
datagrid control and you arent seeing those changes in the database when you
call DataAdapter.Update()?

Let me know exactly the problem so I can help more.
--
Ciaran O''Donnell
http://wannabedeveloper.spaces.live.com
"Andrea Müller" wrote:
Hello,

I have one problem.
Include my project is a dataset with tables.
During my process I create a new temporary table.

The dataset use my DataGrid Control.

The use delete now one, two or more rows.
After that the operator press <saveand I create the new table with
some Reference,
from the table, which the operator deleted.

I go through the table and I see all deleted rows.
Why?
What can I do?
I need not Transmit and Rollback...

If the operator deletes the lines, these are to be deleted.

dataSetDatabase.Query ?? it does not give
dataSetDatabase.ReQuery ?? it does not give
dataSetDatabase.Update ?? it does not give

I need AccepteChanges, yes or no?

A bad solution is that.
My attempt.
dataSetDatabase.tblSequence.Clear();
dataSetDatabase.WriteXml( filename );

dataSetDatabase.Clear();
dataSetDatabase.ReadXml( filename );
create the new table.
Can everybody help me?
Thanks for help.
Regards,
Andrea
Jul 9 '08 #2
Hello,
>call DataAdapter.Update()?
Let me know exactly the problem so I can help more.
I call the Update never, because the dataSetDatabase have no Update
function.

DATASET ---------------- DataGridView for the User
Record Set exist -------
10 Recordset inside -- User see 10 Recordset --fine all ok
10 Recordset inside -- User delete for example 2 -- Use see
8

The problem now. In the Dataset not 8 recordset, also 10, why? It is
stupid.

That is my problem.

Regards Andrea
Jul 10 '08 #3
Ok I think the problem might be that the DataSet holds on to the rows you
delete but marks them as deleted in the dataset with the row.RowState
property. This enables it to know which records to delete if you used a
DataAdapter to update the database.
--
Ciaran O''Donnell
http://wannabedeveloper.spaces.live.com
"Andrea Müller" wrote:
Hello,
call DataAdapter.Update()?
Let me know exactly the problem so I can help more.

I call the Update never, because the dataSetDatabase have no Update
function.

DATASET ---------------- DataGridView for the User
Record Set exist -------
10 Recordset inside -- User see 10 Recordset --fine all ok
10 Recordset inside -- User delete for example 2 -- Use see
8

The problem now. In the Dataset not 8 recordset, also 10, why? It is
stupid.

That is my problem.

Regards Andrea
Jul 10 '08 #4
Hello Ciaran,
Ok I think the problem might be that the DataSet holds on to the
rows you
delete but marks them as deleted in the dataset with the row.RowState
property. This enables it to know which records to delete if you used a
DataAdapter to update the database.
--
so I can check the state.

If the state row.RowState == Deleted I can go one row further.
Correct?

Or maybe with Commit o Rollback .... ?

Regards Andrea
private void DemonstrateRowState()
{
// Run a function to create a DataTable with one column.
DataTable table = MakeTable();
DataRow row;

// Create a new DataRow.
row = table.NewRow();
// Detached row.
Console.WriteLine("New Row " + row.RowState);

table.Rows.Add(row);
// New row.
Console.WriteLine("AddRow " + row.RowState);

table.AcceptChanges();
// Unchanged row.
Console.WriteLine("AcceptChanges " + row.RowState);

row["FirstName"] = "Scott";
// Modified row.
Console.WriteLine("Modified " + row.RowState);

row.Delete();
// Deleted row.
Console.WriteLine("Deleted " + row.RowState);
}

http://msdn.microsoft.com/en-us/libr....rowstate.aspx
Jul 10 '08 #5
If you really only want to work with the modified DataSet and do not care
about updating the database, you can call the GetChanges method.
Peter
"Andrea Mller" <po******@arcor.dewrote in message
news:72**********************************@e39g2000 hsf.googlegroups.com...
Hello Ciaran,
Ok I think the problem might be that the DataSet holds on to the
rows you
>delete but marks them as deleted in the dataset with the row.RowState
property. This enables it to know which records to delete if you used a
DataAdapter to update the database.
--
so I can check the state.

If the state row.RowState == Deleted I can go one row further.
Correct?

Or maybe with Commit o Rollback .... ?

Regards Andrea
private void DemonstrateRowState()
{
// Run a function to create a DataTable with one column.
DataTable table = MakeTable();
DataRow row;

// Create a new DataRow.
row = table.NewRow();
// Detached row.
Console.WriteLine("New Row " + row.RowState);

table.Rows.Add(row);
// New row.
Console.WriteLine("AddRow " + row.RowState);

table.AcceptChanges();
// Unchanged row.
Console.WriteLine("AcceptChanges " + row.RowState);

row["FirstName"] = "Scott";
// Modified row.
Console.WriteLine("Modified " + row.RowState);

row.Delete();
// Deleted row.
Console.WriteLine("Deleted " + row.RowState);
}

http://msdn.microsoft.com/en-us/libr....rowstate.aspx
Jul 10 '08 #6
Hello Peter,
If you really only want to work with the modified DataSet and do not care
about updating the database, you can call the GetChanges method.
Peter"Andrea Mller" <post2...@arcor.dewrote in message
public static void CreateSequences(DataSetRDatabase db)
{
db.tblSequence.Clear();

foreach ( DataSetRDatabase.tblProductRow rowProduct in
db.tblProduct )
{
int idProduct = rowProduct.ProductRef;

The operator delete one or more rows in the DataGridView.
After then the operator press SAVE and I create a new sequence table.
So, the rowProduct is deleted.

GetChanges told me changes yes or no, if yes then....?
Have you a example?

Regards Andrea

Jul 10 '08 #7

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

Similar topics

6
by: dbuchanan | last post by:
Hello, Is this a bug? Is there some kind of work around? I want to add default values for a few columns in my datagridview I found the "DefaultValuesNeeded" event for the datagridview I...
1
by: Brian | last post by:
I've got a couple questions on the new Datagridview control in VS2005. 1) In the old datagrid control at design time I was able to add multiple tablestyles with columns from different...
10
by: michael sorens | last post by:
Is it possible to store an unbound DataGridView component into a setting? I naively tried defining a Setting that is a DataGridView called DGV, then simply assigning it:...
7
by: Mitchell S. Honnert | last post by:
Is there an equivalent of the DataGrid's DataGridTableStyle for the DataGridView? If not, is there an easy way to duplicate the DataGridTableStyle's functionality for the DataGridView? Here's...
0
by: vbt | last post by:
(VS2005) I am new to using the DataGridView and I have read most everything I can find on this subject. But obviously I am not see the hole picture. I am trying to update a data base...
0
by: tom | last post by:
I am working in VS2005 with the DataGridView. When I click on a cell and move on by clicking on another cell all the data is removed from the first cell. Is there a way to prevent this from...
3
by: =?Utf-8?B?Sm9obiBCdW5keQ==?= | last post by:
New to databinding in vs2005, I always did it manually in 2003. I have no problem loading comboboxes, and a change in that combobox changes the data in the textboxes but I can not figure out a way...
6
by: hzgt9b | last post by:
Using VS2005, VB.NET, I have a windows app with a DataGridView (lets call it DGV). At some point in the life of my app I want to clear the selection of the currently selected row...
2
by: hnpatel | last post by:
Hi to All, How to use mouse click event for datagridview in c# in vs2005? I m using datagridview in c# application.I had bound data in datagridview.I want to display data in textbox when i...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, youll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

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.