how come unchanged always true even if data changed
This code come from my saving button:
=============== =============== ==============
DataSet ds1 = new DataSet();
DataSet ds2 = new DataSet();
DataSet ds3 = new DataSet();
//Static Dataset which contain values when my form load
ds1.Tables.Add( ModelSelectionG lobal.dsModelSe lection.Tables["C"].Copy());
//this datatable contain the value of all controls when saving
ds2.Tables.Add( dt.Copy());
ds3.Merge(ds1);
ds3.AcceptChang es();
//now ds1 supposed to be the reference
ds3.Merge(ds2);
//ds2 contain the same structure as ds1 but may have different values
//this test should tell me is ds2 changed ds1 but it does always
return true
if (ds3.HasChanges (DataRowState.U nchanged) == false)
{
for (int y = 0; y <= 31; y++)
{
//filling data with datarows of dt
ModelSelectionG lobal.dsModelSe lection.Tables["C"].Rows[0]
[y] = dr[y];
}
}
=============== =============== =============== ==========
what im doing wrong here ? 5 1861
Hi Franck,
if (ds3.HasChanges (DataRowState.U nchanged) == false)
I think instead you should try:
if (ds3.HasChanges () == false)
and you can actually skip the comparing to 'false':
if (!ds3.HasChange s())
Hope this helps :)
--
_____________
Adam Bieganski http://godevelop.blogspot.com
"Franck" wrote:
how come unchanged always true even if data changed
This code come from my saving button:
=============== =============== ==============
DataSet ds1 = new DataSet();
DataSet ds2 = new DataSet();
DataSet ds3 = new DataSet();
//Static Dataset which contain values when my form load
ds1.Tables.Add( ModelSelectionG lobal.dsModelSe lection.Tables["C"].Copy());
//this datatable contain the value of all controls when saving
ds2.Tables.Add( dt.Copy());
ds3.Merge(ds1);
ds3.AcceptChang es();
//now ds1 supposed to be the reference
ds3.Merge(ds2);
//ds2 contain the same structure as ds1 but may have different values
//this test should tell me is ds2 changed ds1 but it does always
return true
if (ds3.HasChanges (DataRowState.U nchanged) == false)
{
for (int y = 0; y <= 31; y++)
{
//filling data with datarows of dt
ModelSelectionG lobal.dsModelSe lection.Tables["C"].Rows[0]
[y] = dr[y];
}
}
=============== =============== =============== ==========
what im doing wrong here ?
On Oct 19, 10:21 am, Adam Bieganski <abieganski(at) gmail.comwrote:
Hi Franck,
if (ds3.HasChanges (DataRowState.U nchanged) == false)
I think instead you should try:
if (ds3.HasChanges () == false)
and you can actually skip the comparing to 'false':
if (!ds3.HasChange s())
Hope this helps :)
--
_____________
Adam Bieganskihttp://godevelop.blogs pot.com
"Franck" wrote:
how come unchanged always true even if data changed
This code come from my saving button:
=============== =============== ==============
DataSet ds1 = new DataSet();
DataSet ds2 = new DataSet();
DataSet ds3 = new DataSet();
//Static Dataset which contain values when my form load
ds1.Tables.Add( ModelSelectionG lobal.dsModelSe lection.Tables["C"].Copy());
//this datatable contain the value of all controls when saving
ds2.Tables.Add( dt.Copy());
ds3.Merge(ds1);
ds3.AcceptChang es();
//now ds1 supposed to be the reference
ds3.Merge(ds2);
//ds2 contain the same structure as ds1 but may have different values
//this test should tell me is ds2 changed ds1 but it does always
return true
if (ds3.HasChanges (DataRowState.U nchanged) == false)
{
for (int y = 0; y <= 31; y++)
{
//filling data with datarows of dt
ModelSelectionG lobal.dsModelSe lection.Tables["C"].Rows[0]
[y] = dr[y];
}
}
=============== =============== =============== ==========
what im doing wrong here ?
This works but i have a second issue.
when i merge ds2 inside ds3 i thought it would overwrite ds1 thats
already there but it's not. even if the tables have the same name it
does not replace but create another table, so in my ds3 the ds1 is :
ds3.table[0] and ds2 is ds3.table[1]. that's why haschanges say it
havent been changed.
"Franck" wrote:
On Oct 19, 10:21 am, Adam Bieganski <abieganski(at) gmail.comwrote:
Hi Franck,
if (ds3.HasChanges (DataRowState.U nchanged) == false)
I think instead you should try:
if (ds3.HasChanges () == false)
and you can actually skip the comparing to 'false':
if (!ds3.HasChange s())
Hope this helps :)
--
_____________
Adam Bieganskihttp://godevelop.blogs pot.com
"Franck" wrote:
how come unchanged always true even if data changed
This code come from my saving button:
=============== =============== ==============
DataSet ds1 = new DataSet();
DataSet ds2 = new DataSet();
DataSet ds3 = new DataSet();
//Static Dataset which contain values when my form load
ds1.Tables.Add( ModelSelectionG lobal.dsModelSe lection.Tables["C"].Copy());
//this datatable contain the value of all controls when saving
ds2.Tables.Add( dt.Copy());
ds3.Merge(ds1);
ds3.AcceptChang es();
//now ds1 supposed to be the reference
ds3.Merge(ds2);
//ds2 contain the same structure as ds1 but may have different values
//this test should tell me is ds2 changed ds1 but it does always
return true
if (ds3.HasChanges (DataRowState.U nchanged) == false)
{
for (int y = 0; y <= 31; y++)
{
//filling data with datarows of dt
ModelSelectionG lobal.dsModelSe lection.Tables["C"].Rows[0]
[y] = dr[y];
}
}
=============== =============== =============== ==========
what im doing wrong here ?
This works but i have a second issue.
when i merge ds2 inside ds3 i thought it would overwrite ds1 thats
already there but it's not. even if the tables have the same name it
does not replace but create another table, so in my ds3 the ds1 is :
ds3.table[0] and ds2 is ds3.table[1]. that's why haschanges say it
havent been changed.
I think you can get rid of the first 2 datasets completely:
ds3.Tables.Add( ModelSelectionG lobal.dsModelSe lection.Tables["C"].Copy());
ds3.AcceptChang es();
ds3.Merge(dt.Co py());
If this doesn't help - try to explicitly set the names of the tables
returned by the Copy() methods:
DataTable dt1 = ModelSelectionG lobal.dsModelSe lection.Tables["C"].Copy();
dt1.TableName = "Table1";
ds3.Tables.Add( dt1);
ds3.AcceptChang es();
dt1 = dt.Copy();
dt1.TableName = "Table1";
ds3.Merge(dt1);
Cheers,
--
_____________
Adam Bieganski http://godevelop.blogspot.com
On Oct 19, 12:21 pm, Adam Bieganski <abieganski(at) gmail.comwrote:
"Franck" wrote:
On Oct 19, 10:21 am, Adam Bieganski <abieganski(at) gmail.comwrote:
Hi Franck,
if (ds3.HasChanges (DataRowState.U nchanged) == false)
I think instead you should try:
if (ds3.HasChanges () == false)
and you can actually skip the comparing to 'false':
if (!ds3.HasChange s())
Hope this helps :)
--
_____________
Adam Bieganskihttp://godevelop.blogs pot.com
"Franck" wrote:
how come unchanged always true even if data changed
This code come from my saving button:
=============== =============== ==============
DataSet ds1 = new DataSet();
DataSet ds2 = new DataSet();
DataSet ds3 = new DataSet();
//Static Dataset which contain values when my form load
ds1.Tables.Add( ModelSelectionG lobal.dsModelSe lection.Tables["C"].Copy());
//this datatable contain the value of all controls when saving
ds2.Tables.Add( dt.Copy());
ds3.Merge(ds1);
ds3.AcceptChang es();
//now ds1 supposed to be the reference
ds3.Merge(ds2);
//ds2 contain the same structure as ds1 but may have different values
//this test should tell me is ds2 changed ds1 but it does always
return true
if (ds3.HasChanges (DataRowState.U nchanged) == false)
{
for (int y = 0; y <= 31; y++)
{
//filling data with datarows of dt
ModelSelectionG lobal.dsModelSe lection.Tables["C"].Rows[0]
[y] = dr[y];
}
}
=============== =============== =============== ==========
what im doing wrong here ?
This works but i have a second issue.
when i merge ds2 inside ds3 i thought it would overwrite ds1 thats
already there but it's not. even if the tables have the same name it
does not replace but create another table, so in my ds3 the ds1 is :
ds3.table[0] and ds2 is ds3.table[1]. that's why haschanges say it
havent been changed.
I think you can get rid of the first 2 datasets completely:
ds3.Tables.Add( ModelSelectionG lobal.dsModelSe lection.Tables["C"].Copy());
ds3.AcceptChang es();
ds3.Merge(dt.Co py());
If this doesn't help - try to explicitly set the names of the tables
returned by the Copy() methods:
DataTable dt1 = ModelSelectionG lobal.dsModelSe lection.Tables["C"].Copy();
dt1.TableName = "Table1";
ds3.Tables.Add( dt1);
ds3.AcceptChang es();
dt1 = dt.Copy();
dt1.TableName = "Table1";
ds3.Merge(dt1);
Cheers,
--
_____________
Adam Bieganskihttp://godevelop.blogs pot.com
nothing works,
gonna do if statement with and compare all my fields one by one this
im sure it works.
Frank,
AFAIK does merge not change the rowstates, the merge is merging rows (and
adding and changing new ones for old ones, however is not affecting the
fields).
Cor This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Eric |
last post by:
Hello,
I am trying to write a webservice to compare 2 datasets, one recieved
from a client, and the other taken from a database on the webserver.
Sofar, I have had little success in accomplishing that, but that may
be due to the fact that I'm a relative newbie on C# :-)
Does anybody have a clue, a hint, or maybe even some sample code?
|
by: JamesWilce |
last post by:
Hey,
I am stuck on this little problem, I have a database which I use to fill a
dataset when my application loads, however at certain intervals Im filling
another dataset using the same database. What i need to do is find any new
records added. Ive tried all kinds of thinks like DataSet.Merge e.t.c but
just can seem to get the right code combination to find the new records, any
feedback will be really appreciated.
Regards
|
by: Elliot M. Rodriguez |
last post by:
I can accomplish this relatively easily but inefficiently, and it seems like
a hack, but I cant think of a better workaround. Hopefully someone else here
can.
My task is to perform an update on a dataset retrieved from SQL Server 2000
using a stored procedure. This is the base dataset. Users will send an Excel
document up to a webserver and that excel document, which matches the schema
of the SQL dataset (few differences but nothing ...
|
by: Will Lastname |
last post by:
In one of the applications that I'm working on I have 2 sets of
functions that build different datasets.
Imagine 4 columns in a datagrid. Inside those 4 columns I have nested
datalists. Two of the datalists' datasources point to database A and
the other two point to database B. This effect allows the client to
perform a side-by-side comparison of the same product so that records
can be updated accordingly. It's easy enough to scroll down...
|
by: Jeff |
last post by:
Hi -
I'm experiencing a strange problem when comparing 2 guids. In my trial,
they're not equal. When I step through the (VB.NET) code, they are
evaluated as equal, and when I enter the comparison in the command window,
they're not equal. I'm pretty stumped on this one. Please help.
I've tried the following structures, all with the same result:
guid1.equals(guid2)
| |
by: Arne |
last post by:
How do I pass a dataset to a webservices? I need to submit a shoppingcart
from a pocket PC to a webservice.
What is the right datatype?
II have tried dataset as a datatype, but I can't get it to compile.
<WebMethod()> _
Public Function VerifySku(ByVal skus As XmlDataDocument) As DataSet
Test program :
Dim cartSet As DataSet
cartSet = ws.VerifySku(cartSet)
|
by: Frank |
last post by:
Hello,
Developing an app where the user fills out a sometimes quite lengthy
form of chkboxes, txtboxes, radbtns, etc. User responses are saved to
a mySql db, which the user can later edit.
When the user chooses to edit, I pull the responses from the db, toss
them in a dataset, check the checks, fill the txtboxes, etc.,etc.
The user then adds, deletes, or changes entries as needed and clicks
the Save Changes button. Here is where the fun...
|
by: Frank |
last post by:
Hello All,
I am working on a vb.net app where I need to compare to 2 datatables
and determine if a string exists in one or both. The first dt is
filled from the db. A form is loaded and the appropriate items in a
checkedlist box are selected based on the dt. So far, no problem. Then
user can then edit the values in the checkedlist box and choose to
save changes. When they save changes, I throw the new values of the
checked items from...
|
by: Nick Hodge \(MVP\) |
last post by:
Hi
I currently have a gridview connected to a SQLDatasource. (This data comes
from a remote iSeries). It shows catalogue sales as they build during the
day (works great). I have a local SQL server with the budget data for each
catalogue/day and wanted to compare the gridview data with this to display
KPI traffic lights as the sales build. (This is used across the organisation
and is connected 'live')
One issue is that all catalogue...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |