473,378 Members | 1,623 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,378 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 1896
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 Müller" <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 Müller" <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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.