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

DataRelation and Fill(ds, int, int, dt)

I've filled a DataSet with two tables then established a DataRelation; all
is well because the backend includes RI rules that ensure that no record on
the detail side will be without a master record. However, there are too
many records on the master side for an efficient use of the app over the web
via website or VPN. So, I've implemented Fill(ds, int, int, dt) such that I
control how many records are downloaded. Now the problem is that the detail
table is left with many records that have no corresponding records on the
master side and the DataRelation won't take.

My question is what is the best method of fetching only the related records?
I've seen GetChildRows, but I'm hoping that there is a 'built-in' way of
doing this through the DataAdapter. If not, then my question is do I use
this or something like it:

DataRow[] arrRows;
foreach(DataRow masterRow in masterTable.Rows){
arrRows = masterRow.GetChildRows(myRelation);
....
}

If so, how do I get arrRows into the correct Table of the DataSet? Is
foreach with the Add method of the DataRowCollection class the way to go
with this?

Thanks.
Nov 17 '05 #1
2 1737
Hi Christopher,

I would collect all master table primary key values, create a sql select
statement for detail rows with something like WHERE master.primarykey IN (my
values) and fill only these detail rows.

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/
SLODUG - Slovene Developer Users Group www.codezone-si.info

"Christopher Weaver" <we*****@verizon.net> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
I've filled a DataSet with two tables then established a DataRelation; all
is well because the backend includes RI rules that ensure that no record
on the detail side will be without a master record. However, there are
too many records on the master side for an efficient use of the app over
the web via website or VPN. So, I've implemented Fill(ds, int, int, dt)
such that I control how many records are downloaded. Now the problem is
that the detail table is left with many records that have no corresponding
records on the master side and the DataRelation won't take.

My question is what is the best method of fetching only the related
records? I've seen GetChildRows, but I'm hoping that there is a 'built-in'
way of doing this through the DataAdapter. If not, then my question is do
I use this or something like it:

DataRow[] arrRows;
foreach(DataRow masterRow in masterTable.Rows){
arrRows = masterRow.GetChildRows(myRelation);
....
}

If so, how do I get arrRows into the correct Table of the DataSet? Is
foreach with the Add method of the DataRowCollection class the way to go
with this?

Thanks.

Nov 17 '05 #2
This is good. Thanks.

"Miha Markic [MVP C#]" <miha at rthand com> wrote in message
news:eK**************@TK2MSFTNGP10.phx.gbl...
Hi Christopher,

I would collect all master table primary key values, create a sql select
statement for detail rows with something like WHERE master.primarykey IN
(my values) and fill only these detail rows.

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/
SLODUG - Slovene Developer Users Group www.codezone-si.info

"Christopher Weaver" <we*****@verizon.net> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
I've filled a DataSet with two tables then established a DataRelation;
all is well because the backend includes RI rules that ensure that no
record on the detail side will be without a master record. However,
there are too many records on the master side for an efficient use of the
app over the web via website or VPN. So, I've implemented Fill(ds, int,
int, dt) such that I control how many records are downloaded. Now the
problem is that the detail table is left with many records that have no
corresponding records on the master side and the DataRelation won't take.

My question is what is the best method of fetching only the related
records? I've seen GetChildRows, but I'm hoping that there is a
'built-in' way of doing this through the DataAdapter. If not, then my
question is do I use this or something like it:

DataRow[] arrRows;
foreach(DataRow masterRow in masterTable.Rows){
arrRows = masterRow.GetChildRows(myRelation);
....
}

If so, how do I get arrRows into the correct Table of the DataSet? Is
foreach with the Add method of the DataRowCollection class the way to go
with this?

Thanks.


Nov 17 '05 #3

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

Similar topics

1
by: yaser | last post by:
Hello: I need save my update but i can't :confused: :confused: :confused: look my code : Imports System.Data Imports System.Data.OleDb Public Class Form1
7
by: freddy | last post by:
Here is my code string Conn ="Provider=Microsoft.Jet.OLEDB.4.0;Data Source = c:\\\\G_Drive_Entitlements_STM_2005.xls;" + "Extended Properties=Excel 8.0;"; OleDbConnection dbConn = new...
2
by: wackyphill | last post by:
I have a long running query. I want the results in a DataGrid. I'd like the grid and form to be responsive and fill up w/ rows as the result set is read into a dataset that is the datasource of the...
1
by: Jorge Maganto | last post by:
Hi! I'm building a site in ASP.NET which makes a query that return 50.000 results, this result is read by a DataAdapter to a DataSet (myDataAdter.Fill(myDataSet)). The problem is if the query is...
1
by: Thu | last post by:
Hi, I create a Dataset to link three tables in my Access database. E.g. The three tables are , , . I then create 2 DataRelations, 1st relation (Order_Cust_Rel) links and using CustomerID field...
7
by: Rich | last post by:
Hello, I am pulling master data from one master table and detail data from two detail tables. The rows from the master data are displayed in textboxes on my form which are bound to the data...
2
by: Rich | last post by:
Hello, Following an example at http://www.vb-tips.com/dbpages.aspx?IA=DG (by Cor Lightert and Ken Tucker) on binding a dataRelation to a Datagridview for sqlClient, I was able to view rows...
2
by: MDB | last post by:
Hello All, I have a data grid that I fill using a dataset. The results of the query has around 15 columns and 500 rows (and growing). The reason I am using the datagrid is so the end users can...
2
by: slinky | last post by:
I'm getting a error when I open my . aspx in my browser... line 34: da.Fill(ds, "Assets") Here's the error and my entire code for this .aspx.vb is below that ... I need some clues as to what is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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
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.