473,399 Members | 2,159 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,399 software developers and data experts.

rowstate problems

I have a datagrid in a windows forms application. The datagrid gets its
data via a web service. Users can modify rows in the datagrid then post
their changes. However, when changes are made the rowstate remains
"Added" for all the rows--those that were modified AND those that were
unchanged. Here is the code I am using to test (dsitems is the
underlying dataset):

private void btnSave_Click(object sender, System.EventArgs e)
{
string res=string.Empty;
foreach(DataRow dr in dsitems.GetChanges().Tables[0].Rows)
{
res+=String.Format("{0}|{1}|{2}\n",
dr["pagetitle"],
dr["pagelocation"],
dr.RowState.ToString()
);
}
lblresults.Text=res;
}

Any ideas as to why the rowstate is always set to "Added" ?
*** Sent via Developersdex http://www.developersdex.com ***
Nov 17 '05 #1
2 2146
Phil,

Is it possible that the rowset that you receive already has that as the
rowstate? Is it possible that the web service is constructing the data set
and not calling AcceptChanges (since it might create it from scratch and add
the rows manually)?

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Phil Townsend" <ph*******@yahoo.com> wrote in message
news:%2***************@tk2msftngp13.phx.gbl...
I have a datagrid in a windows forms application. The datagrid gets its
data via a web service. Users can modify rows in the datagrid then post
their changes. However, when changes are made the rowstate remains
"Added" for all the rows--those that were modified AND those that were
unchanged. Here is the code I am using to test (dsitems is the
underlying dataset):

private void btnSave_Click(object sender, System.EventArgs e)
{
string res=string.Empty;
foreach(DataRow dr in dsitems.GetChanges().Tables[0].Rows)
{
res+=String.Format("{0}|{1}|{2}\n",
dr["pagetitle"],
dr["pagelocation"],
dr.RowState.ToString()
);
}
lblresults.Text=res;
}

Any ideas as to why the rowstate is always set to "Added" ?
*** Sent via Developersdex http://www.developersdex.com ***

Nov 17 '05 #2
Phil,

Is it possible that the rowset that you receive already has that as the
rowstate? Is it possible that the web service is constructing the data set
and not calling AcceptChanges (since it might create it from scratch and add
the rows manually)?

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Phil Townsend" <ph*******@yahoo.com> wrote in message
news:%2***************@tk2msftngp13.phx.gbl...
I have a datagrid in a windows forms application. The datagrid gets its
data via a web service. Users can modify rows in the datagrid then post
their changes. However, when changes are made the rowstate remains
"Added" for all the rows--those that were modified AND those that were
unchanged. Here is the code I am using to test (dsitems is the
underlying dataset):

private void btnSave_Click(object sender, System.EventArgs e)
{
string res=string.Empty;
foreach(DataRow dr in dsitems.GetChanges().Tables[0].Rows)
{
res+=String.Format("{0}|{1}|{2}\n",
dr["pagetitle"],
dr["pagelocation"],
dr.RowState.ToString()
);
}
lblresults.Text=res;
}

Any ideas as to why the rowstate is always set to "Added" ?
*** Sent via Developersdex http://www.developersdex.com ***

Nov 17 '05 #3

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

Similar topics

6
by: BStorm | last post by:
Is it possible to change individual RowState properties from updated to not updated?
0
by: Phil Townsend | last post by:
I have a datagrid in a windows forms application. The datagrid gets its data via a web service. Users can modify rows in the datagrid then post their changes. However, when changes are made the...
0
by: Neil | last post by:
Hi, I'm getting some strange results using the autoincrement column on my datatable. I'm populating a datatable with data from my database and displaying this in a datagrid. The first time I get...
6
by: astro | last post by:
I'm working through the binder stuff trying to get a handle on it... I have setup a master-detail dataset and have a couple of textboxes from the master along with a datadgrid for the child data....
6
by: timbobd | last post by:
I have a Windows form that displays a database table in a DataGrid. When you click on a row, the row's values get copied to bound TextBoxes below, and when the "Save" button is clicked the database...
0
by: Jarod | last post by:
Hey I have GridViewEventArgs e. And this e.Row.RowState returns current state. I woudl like to check if e.Row.Rowstate == ...Edit; But the problem is sometimes Rowstate is something like this :...
13
by: Dale Harris | last post by:
I'm getting really strange behaviour where the data source RowState is not being updated to modified in some circumstances. I place my controls on a form, bind them through a BindingSource control...
3
by: perspolis | last post by:
Hi all I have a master detail table which I use them in Transaction to Update them. in some cases the detail table generates error and I Rollback transaction but RowState of master table dosen't...
2
by: Gurny | last post by:
I have a DataSet I am loading via the DataSet.Tables.Add() method. I call the AcceptChanges method on the DataTable first thing. Every thing looks good i.e. RowStates are all Unchanged. I then...
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: 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
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...
0
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,...
0
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,...
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.