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

Nested tables - How do you add a new row to a nested table? (codeattached)

I have a dataset setup with a main table that has some information in it
along with an element that is a nested table so that I can store rows of
history information for that one row in the main table. This all works
fine in a datagrid I can add rows to the nested table of any of my
customer rows... However in code I can't figure out how to do the same
thing... the only function I can find is "GetHistoryRows"... I'm
completely lost here - how would I go about adding a history row?

Below is a simple version of the schema that i'm using:

<?xml version="1.0" encoding="utf-8" ?>
<xs:schema id="debug" targetNamespace="http://tempuri.org/debug.xsd"
elementFormDefault="qualified"
attributeFormDefault="qualified" xmlns="http://tempuri.org/debug.xsd"
xmlns:mstns="http://tempuri.org/debug.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="debug" msdata:IsDataSet="true">
<xs:complexType>
<xs:choice maxOccurs="unbounded">
<xs:element name="customers">
<xs:complexType>
<xs:sequence>
<xs:element name="name" type="xs:string" minOccurs="0" />
<xs:element name="history">
<xs:complexType>
<xs:sequence>
<xs:element name="date" type="xs:dateTime" minOccurs="0" />
<xs:element name="description" type="xs:string" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
Nov 17 '05 #1
1 2680
If you're storing the data in a DataSet then you need a second
DataTable, say called CustomerHistory, that has a foreign key relation
with your Customer table, in a parent / child relationship, where
Customer is the parent, and CustomerHistory is the child table.

Effectively, every row in the CustomerHistory table will have some sort
of identifier to indicate to which Customer it belongs. The table will
store history for all customers, but you'll know to which Customer a
given row of CustomerHistory belongs by looking at that identifier.

You can also enforce this relationship in ADO.NET using a
ForeignKeyConstraint.

Nov 17 '05 #2

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

Similar topics

1
by: siu02rk | last post by:
Hello All, Can anyone please explain to me why you would need to use Nested tables and give an example. Also can you show the SQL to view the table and the nested table and explain the logic of...
1
by: Joseph Ferris | last post by:
Hello, I am having an issue with page breaking that I hope someone will be able to help me with. Still a relative "newbie", and I thought this might be a good place to find some help. I have a...
1
by: boris bass | last post by:
Below is linenumbered as well as original code -------------------------------------- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META http-equiv=Content-Type...
1
by: Eric Bohlman | last post by:
What's the correct technique for nesting a bordered table inside of cell of another bordered table without getting a double-thickness border around the nested table? This is assuming the...
5
by: Roedy Green | last post by:
I generate code to refer people to bookstores that generates a table without internal borders. You can see an example on http://mindprod.com/environment/kyoto.html I can use this element nested...
1
by: travis_brooks | last post by:
greetings I had a javascript that was reliably telling me the position of an image on a page, and now its not. I was using the script to draw a bounding box that followed the mouse around over...
1
by: le_sloth | last post by:
Hi I'm generating a series of reports from an application that will be published on a client's intranet. The idea is that each of these reports is arranged into major product groups,...
5
by: Giggle Girl | last post by:
Is there a way to prevent properties (specifically, height and background color) from being "inherited" by nested tables? Something similar (but sort of opposite to) !important, like...
6
by: R144N | last post by:
Hi Everyone, I have finally taken the step to bring a site to the 21st century with HTML 4.01 with the height tag having been deprecated. I have read numerous articles claiming that the CSS...
1
by: Krishna C | last post by:
what is the difference b/w VARRAY,RecordType,table type and nested tables data types?
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
0
BarryA
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...
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
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
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...
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
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...
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...
0
agi2029
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,...

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.