Need help with correct syntax to search a child table in ADO.net .

G

Gordo

Hi;

I am try to select only child rows of data from two
related dataset data tables. I am using
the "table.select" method.

Here is an example of the code :

Dim holdstr As String =
MonthCalendar1.SelectionEnd.ToShortDateString


For Each rowCase In dsCases.Tables("dtCases").Rows
For Each rowDoc In rowCase.GetChildRows
("Casenme")

aDocs() = rowDoc.Table.Select
("doc_dte_due = '" & holdstr & "'")
Next rowDoc
Next rowCase

Next in the code I want to load a list box with the
selected records.

ListBox1.Items.Add(rowCase("case_id") & " " & rowDoc
("Document_nme"))


Casenme being the name of the relation object.

I have tried to find a example of this being done in
several books and in the ADO.net documentation. But the
only examples for example ppgs 340-341 in David Sceppa's
excellent ADO.net reference book, use only single tables
using string literals. I need to use a string variable.

Has anyone here encountered a similar problem ?

Thanks,

Gordon
 
G

Gordo

-----Original Message-----
Hi;

I am try to select only child rows of data from two
related dataset data tables. I am using
the "table.select" method.

Here is an example of the code :

Dim holdstr As String =
MonthCalendar1.SelectionEnd.ToShortDateString


For Each rowCase In dsCases.Tables("dtCases").Rows
For Each rowDoc In rowCase.GetChildRows
("Casenme")

aDocs() = rowDoc.Table.Select
("doc_dte_due = '" & holdstr & "'")
Next rowDoc
Next rowCase

Next in the code I want to load a list box with the
selected records.

ListBox1.Items.Add(rowCase("case_id") & " " & rowDoc
("Document_nme"))


Casenme being the name of the relation object.

I have tried to find a example of this being done in
several books and in the ADO.net documentation. But the
only examples for example ppgs 340-341 in David Sceppa's
excellent ADO.net reference book, use only single tables
using string literals. I need to use a string variable.

Has anyone here encountered a similar problem ?

Thanks,

Gordon

.
------- Response ------------------------------------

FYI.

Intensive research finally pays off.

VS.net Technical Article - Navigating Multiple Related
Tables in an ADO.net recordset. See the MSDN library for
this article.

Here is the article's description:

Steve Stein
Visual Studio Team
Microsoft Corporation

February 2002

Summary: A dataset in ADO.NET is an in-memory
representation of data that can contain multiple related
data tables. This paper describes the methods of
navigating these related data tables within a dataset.
You will create a Windows® application in Visual
Basic® .NET or Visual C#T .NET that returns related
records based on a selected record, as well as compile
aggregate information for related records using
expression columns. (14 printed pages)
 
Top