Hello all, I've made a dataset by using the xsd tool in C#. In the xsd
schema, there are a few tables, each has its own primary key. And, I've made
relation between them.
After all things are done, I can use the dataset class generated to retrieve
data. The problem is that, when I try to delete a parent row (using
RemoveTABLERow method), both the parent and child tables rowcount decrease as
expected. But only the changes done in child table can be updated to the DB.
The parent row is still there.
I've tried the sequence suggested by MSDN:
1. Child table: delete records.
2. Parent table: insert, update, and delete records.
3. Child table: insert and update records.
Sometimes nothing changed in DB. Sometimes only child table show changes.
Could anyone give me any hint what I should do to fix the situation? 2 5482
Hi,
Can you please post some code? Meanwhile, please make sure you properly
configure Insert/Update/DeleteCommands on all of the data adapters and that
you never call AcceptChanges before calling Update() on the data adapters.
--
Sincerely,
Dmytro Lapshyn [Visual Developer - Visual C# MVP]
"Kenny" <Ke***@discussions.microsoft.com> wrote in message
news:99**********************************@microsof t.com... Hello all, I've made a dataset by using the xsd tool in C#. In the xsd schema, there are a few tables, each has its own primary key. And, I've made relation between them.
After all things are done, I can use the dataset class generated to retrieve data. The problem is that, when I try to delete a parent row (using RemoveTABLERow method), both the parent and child tables rowcount decrease as expected. But only the changes done in child table can be updated to the DB. The parent row is still there.
I've tried the sequence suggested by MSDN: 1. Child table: delete records. 2. Parent table: insert, update, and delete records. 3. Child table: insert and update records.
Sometimes nothing changed in DB. Sometimes only child table show changes.
Could anyone give me any hint what I should do to fix the situation?
Thx much, Dmytro.
I realized that I've used the wrong function to delete the row in my
dataset. Now I can do what I want.
However, if I load data from more than 10 tables (say, a few rows per
table), all are linked up by parent-child relations. My update functions must
be arranged very carefully in a particular order (Child table row deletion
first...). Is that correct?
Are there any easier way to deal with updating the DB?
Thanks again.
"Dmytro Lapshyn [MVP]" wrote: Hi,
Can you please post some code? Meanwhile, please make sure you properly configure Insert/Update/DeleteCommands on all of the data adapters and that you never call AcceptChanges before calling Update() on the data adapters.
-- Sincerely, Dmytro Lapshyn [Visual Developer - Visual C# MVP]
"Kenny" <Ke***@discussions.microsoft.com> wrote in message news:99**********************************@microsof t.com... Hello all, I've made a dataset by using the xsd tool in C#. In the xsd schema, there are a few tables, each has its own primary key. And, I've made relation between them.
After all things are done, I can use the dataset class generated to retrieve data. The problem is that, when I try to delete a parent row (using RemoveTABLERow method), both the parent and child tables rowcount decrease as expected. But only the changes done in child table can be updated to the DB. The parent row is still there.
I've tried the sequence suggested by MSDN: 1. Child table: delete records. 2. Parent table: insert, update, and delete records. 3. Child table: insert and update records.
Sometimes nothing changed in DB. Sometimes only child table show changes.
Could anyone give me any hint what I should do to fix the situation?
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Maurice Mertens |
last post by:
Hi,
I have an Access database in which I defined default values for certain
columns. On my windows forms I've got controls bound to the dataset, The
problem is that when I add a new row to the...
|
by: Stedak |
last post by:
We currently use a home grown update server to update our clients with our
application. The client has a service on a server that checks for updates
from our server and the clients will update...
|
by: Fernanda |
last post by:
Good afternoon,
I have a function in a remote server which receives a dataset and makes (or
at least should do) necessary updates. However, Im receiving this error
message in my client browser...
|
by: Robert |
last post by:
I sent this last week, but am unable to go that far back
in the newsgroup to read the answer, so I'm posting again:
I'm using the Jet.Oledb to connect to an Access 2002
database. I have a form...
|
by: ksrajalakshmi |
last post by:
Hai,
I've displayed all data in a datagrid. the datasource is a dataset.
the user can modify the data in the datagrid.
the updated data in the datagrid to be updated in datatable.
i used the...
|
by: metaperl |
last post by:
I'm actually taking Microsoft's 2779 and just finished a lab where we
kept track of our changes to the database.
However, I'm not happy with the scripts interface because it does not
tell me the...
|
by: GoogleGroups |
last post by:
It seems like this should be easy, but it has proven to be quite
painful.
I have an existing dataset, which I used the GetChanges and WriteXML
functions upon to write out a DiffGram to a local...
|
by: leaf0209 |
last post by:
Hi,
I am new to this forum and have been troubled by this problem for the past few days. I would appreciate if someone would take a look and help me out.
I am using vb express 2005 edition... I...
|
by: k3nTm |
last post by:
Is there a way to place the data from my sql server 2005 database to dataset randomly in a row. coz I have quiz engine and i want to display it in lablebox randomly form a dataset.
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
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: 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,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
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,...
|
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...
|
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...
|
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,...
| |