473,378 Members | 1,396 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,378 software developers and data experts.

DataRelation vs DataView.RowFilter property

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 with databinding. The data from the 2
detail tables are displayed in 2 datagridviews. I filter each datagridview
with a Dataview object using the dataview.Rowfilter property. This is sort
of working except that I am getting an except on one of my detail tables
(used to be no exceptions until I converted the detail tables into views on
the sql server - to simplify select command sql). So I was reading up on the
DataRelations object.

Before I knock myself out changing all my client code, can I achieve the
same row filtering functionality by using DataRelations instead of
Dataview.Rowfilter for the datagridviews? According to the reading, I
interpreted the reading to suggest that DataRelations are more efficient -
but the only specified that it was more efficient than using a join statement
in the select command. Any suggestions appreciated on if I should use a
DataRelation vs Dataview.Rowfilter.

Thanks,
Rich
May 23 '06 #1
7 5596
I decided to go ahead an experiment with DataRelations. Anyway, I am not
getting any row filtering for the datagridviews. However, I do get rowfilter
when I use the Dataview.Rowfilter property. So, does anyone have an
understandable way to use DataRelations?

"Rich" wrote:
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 with databinding. The data from the 2
detail tables are displayed in 2 datagridviews. I filter each datagridview
with a Dataview object using the dataview.Rowfilter property. This is sort
of working except that I am getting an except on one of my detail tables
(used to be no exceptions until I converted the detail tables into views on
the sql server - to simplify select command sql). So I was reading up on the
DataRelations object.

Before I knock myself out changing all my client code, can I achieve the
same row filtering functionality by using DataRelations instead of
Dataview.Rowfilter for the datagridviews? According to the reading, I
interpreted the reading to suggest that DataRelations are more efficient -
but the only specified that it was more efficient than using a join statement
in the select command. Any suggestions appreciated on if I should use a
DataRelation vs Dataview.Rowfilter.

Thanks,
Rich

May 23 '06 #2
Rich,

Are you sure that you are not able to read very few data by using the Where
clause in your selects.

I mean,
One table with one datarow for your mainrow
Two tables with more datarows for your datagrids,

In my opinion is that the most easy to handle.

(Maybe you need beside that a listbox or combobox to select the mainrow that
you want, which needs an extra table). Be aware that normally the user takes
a natural short pause if he selects a main part of data.

The join will not help you, a joined table is using the normal methods for
that not updatable

A problem with the datarelations (at least in version 1.x) is AFAIK that
they are not simple bindable.

Just my idea,

Cor
"Rich" <Ri**@discussions.microsoft.com> schreef in bericht
news:11**********************************@microsof t.com...
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 with databinding. The data from the 2
detail tables are displayed in 2 datagridviews. I filter each
datagridview
with a Dataview object using the dataview.Rowfilter property. This is
sort
of working except that I am getting an except on one of my detail tables
(used to be no exceptions until I converted the detail tables into views
on
the sql server - to simplify select command sql). So I was reading up on
the
DataRelations object.

Before I knock myself out changing all my client code, can I achieve the
same row filtering functionality by using DataRelations instead of
Dataview.Rowfilter for the datagridviews? According to the reading, I
interpreted the reading to suggest that DataRelations are more efficient -
but the only specified that it was more efficient than using a join
statement
in the select command. Any suggestions appreciated on if I should use a
DataRelation vs Dataview.Rowfilter.

Thanks,
Rich

May 24 '06 #3
Rich,

I remember me that the databinding I am talking about is with simple
controls in the reverse order as you want.

Here is almost exactly your problem although it goes 3 instead as you need 2
deep.

http://www.vb-tips.com/dbpages.aspx?IA=DG

I hope this helps,

Cor
"Rich" <Ri**@discussions.microsoft.com> schreef in bericht
news:6A**********************************@microsof t.com...
I decided to go ahead an experiment with DataRelations. Anyway, I am not
getting any row filtering for the datagridviews. However, I do get
rowfilter
when I use the Dataview.Rowfilter property. So, does anyone have an
understandable way to use DataRelations?

"Rich" wrote:
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 with databinding. The data from the
2
detail tables are displayed in 2 datagridviews. I filter each
datagridview
with a Dataview object using the dataview.Rowfilter property. This is
sort
of working except that I am getting an except on one of my detail tables
(used to be no exceptions until I converted the detail tables into views
on
the sql server - to simplify select command sql). So I was reading up on
the
DataRelations object.

Before I knock myself out changing all my client code, can I achieve the
same row filtering functionality by using DataRelations instead of
Dataview.Rowfilter for the datagridviews? According to the reading, I
interpreted the reading to suggest that DataRelations are more
efficient -
but the only specified that it was more efficient than using a join
statement
in the select command. Any suggestions appreciated on if I should use a
DataRelation vs Dataview.Rowfilter.

Thanks,
Rich

May 24 '06 #4
Hi Cor,

Thank you for your reply to my question. I went to your website. I read
your article on Datagridview and datarelations. It looks like a great
article. I tried the example, but I was not able to get it to work. Here is
what I tried (using VB2005):

....

'--note: I am only using 1 dataAdapter to fill my dataset
....
da.Fill(ds, "maintbl")
da.Fill(ds, "detail1")
da.Fill(ds, "detail2")

ds.Relations.Add("relDetail1", ds.tables("maintbl").columns("ID1"),
ds.Tables("detail1").columns("ID1"))
ds.Relations.Add("relDetail2", ds.Tables("maintbl").columns("ID2"),
ds.Tables("detail2").columns("ID2"))

'--note: maintable data is displayed in textboxes on the form. I iterate
through
'--maintbl and display 1 row of data at a time. I want to display the
related rows
'--in the datagridviews

datagridview1.Datasource = ds
datagridview2.datasource = ds

datagridview1.Datamember = "maintbl.relDetail1"
datagridview2.Datamember = "maintbl.relDetail2"

When I bring up the form, I see the data from maintbl in the textboxes on
the form, but there is no data in either of the datagridviews. May I request
if you could see/explain what I am doing incorrectly?

Thanks,
Rich

"Cor Ligthert [MVP]" wrote:
Rich,

I remember me that the databinding I am talking about is with simple
controls in the reverse order as you want.

Here is almost exactly your problem although it goes 3 instead as you need 2
deep.

http://www.vb-tips.com/dbpages.aspx?IA=DG

I hope this helps,

Cor
"Rich" <Ri**@discussions.microsoft.com> schreef in bericht
news:6A**********************************@microsof t.com...
I decided to go ahead an experiment with DataRelations. Anyway, I am not
getting any row filtering for the datagridviews. However, I do get
rowfilter
when I use the Dataview.Rowfilter property. So, does anyone have an
understandable way to use DataRelations?

"Rich" wrote:
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 with databinding. The data from the
2
detail tables are displayed in 2 datagridviews. I filter each
datagridview
with a Dataview object using the dataview.Rowfilter property. This is
sort
of working except that I am getting an except on one of my detail tables
(used to be no exceptions until I converted the detail tables into views
on
the sql server - to simplify select command sql). So I was reading up on
the
DataRelations object.

Before I knock myself out changing all my client code, can I achieve the
same row filtering functionality by using DataRelations instead of
Dataview.Rowfilter for the datagridviews? According to the reading, I
interpreted the reading to suggest that DataRelations are more
efficient -
but the only specified that it was more efficient than using a join
statement
in the select command. Any suggestions appreciated on if I should use a
DataRelation vs Dataview.Rowfilter.

Thanks,
Rich


May 24 '06 #5
Hello again Cor,

I tried your example from your webside exactly as you had it. Your example
worked perfectly against the Northwind database. When I click on a row in
Datagridview1 the corresponding rows show up in the other 2 datagrids. I was
just not able to make it work for my situation. I will have to keep studying
your example.

Rich

"Cor Ligthert [MVP]" wrote:
Rich,

I remember me that the databinding I am talking about is with simple
controls in the reverse order as you want.

Here is almost exactly your problem although it goes 3 instead as you need 2
deep.

http://www.vb-tips.com/dbpages.aspx?IA=DG

I hope this helps,

Cor
"Rich" <Ri**@discussions.microsoft.com> schreef in bericht
news:6A**********************************@microsof t.com...
I decided to go ahead an experiment with DataRelations. Anyway, I am not
getting any row filtering for the datagridviews. However, I do get
rowfilter
when I use the Dataview.Rowfilter property. So, does anyone have an
understandable way to use DataRelations?

"Rich" wrote:
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 with databinding. The data from the
2
detail tables are displayed in 2 datagridviews. I filter each
datagridview
with a Dataview object using the dataview.Rowfilter property. This is
sort
of working except that I am getting an except on one of my detail tables
(used to be no exceptions until I converted the detail tables into views
on
the sql server - to simplify select command sql). So I was reading up on
the
DataRelations object.

Before I knock myself out changing all my client code, can I achieve the
same row filtering functionality by using DataRelations instead of
Dataview.Rowfilter for the datagridviews? According to the reading, I
interpreted the reading to suggest that DataRelations are more
efficient -
but the only specified that it was more efficient than using a join
statement
in the select command. Any suggestions appreciated on if I should use a
DataRelation vs Dataview.Rowfilter.

Thanks,
Rich


May 24 '06 #6
Rich,

You are using 1 dataadapter, however between the fills I see no change of
the SelectCommand, *I* don't not know a method performing this. You need at
least three daatatables (or with one, seperate SelectCommands for that) and
not a joined resultset.

I don't know if you use a command with wich you get 3 times 3 tables, but
that for probably understandable reasons I never tried.

Would you not first try it with 3 dataadapters, which consumes nothing
extra.

Cor

"Rich" <Ri**@discussions.microsoft.com> schreef in bericht
news:34**********************************@microsof t.com...
Hi Cor,

Thank you for your reply to my question. I went to your website. I read
your article on Datagridview and datarelations. It looks like a great
article. I tried the example, but I was not able to get it to work. Here
is
what I tried (using VB2005):

...

'--note: I am only using 1 dataAdapter to fill my dataset
...
da.Fill(ds, "maintbl")
da.Fill(ds, "detail1")
da.Fill(ds, "detail2")

ds.Relations.Add("relDetail1", ds.tables("maintbl").columns("ID1"),
ds.Tables("detail1").columns("ID1"))
ds.Relations.Add("relDetail2", ds.Tables("maintbl").columns("ID2"),
ds.Tables("detail2").columns("ID2"))

'--note: maintable data is displayed in textboxes on the form. I iterate
through
'--maintbl and display 1 row of data at a time. I want to display the
related rows
'--in the datagridviews

datagridview1.Datasource = ds
datagridview2.datasource = ds

datagridview1.Datamember = "maintbl.relDetail1"
datagridview2.Datamember = "maintbl.relDetail2"

When I bring up the form, I see the data from maintbl in the textboxes on
the form, but there is no data in either of the datagridviews. May I
request
if you could see/explain what I am doing incorrectly?

Thanks,
Rich

"Cor Ligthert [MVP]" wrote:
Rich,

I remember me that the databinding I am talking about is with simple
controls in the reverse order as you want.

Here is almost exactly your problem although it goes 3 instead as you
need 2
deep.

http://www.vb-tips.com/dbpages.aspx?IA=DG

I hope this helps,

Cor
"Rich" <Ri**@discussions.microsoft.com> schreef in bericht
news:6A**********************************@microsof t.com...
>I decided to go ahead an experiment with DataRelations. Anyway, I am
>not
> getting any row filtering for the datagridviews. However, I do get
> rowfilter
> when I use the Dataview.Rowfilter property. So, does anyone have an
> understandable way to use DataRelations?
>
> "Rich" wrote:
>
>> 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 with databinding. The data from
>> the
>> 2
>> detail tables are displayed in 2 datagridviews. I filter each
>> datagridview
>> with a Dataview object using the dataview.Rowfilter property. This is
>> sort
>> of working except that I am getting an except on one of my detail
>> tables
>> (used to be no exceptions until I converted the detail tables into
>> views
>> on
>> the sql server - to simplify select command sql). So I was reading up
>> on
>> the
>> DataRelations object.
>>
>> Before I knock myself out changing all my client code, can I achieve
>> the
>> same row filtering functionality by using DataRelations instead of
>> Dataview.Rowfilter for the datagridviews? According to the reading, I
>> interpreted the reading to suggest that DataRelations are more
>> efficient -
>> but the only specified that it was more efficient than using a join
>> statement
>> in the select command. Any suggestions appreciated on if I should use
>> a
>> DataRelation vs Dataview.Rowfilter.
>>
>> Thanks,
>> Rich


May 24 '06 #7
Hi Cor,

I made a simpler version of my form that only pulled the data as in your
example - with separate dataAdapters. It worked perfectly, just like your
example. I will still need to practice a little bit to really understand
datarelations. But now I have a start.

I thank you so much for your help and for sharing that great article about
dataRelations.

Thanks very much for your help.

Rich

"Cor Ligthert [MVP]" wrote:
Rich,

You are using 1 dataadapter, however between the fills I see no change of
the SelectCommand, *I* don't not know a method performing this. You need at
least three daatatables (or with one, seperate SelectCommands for that) and
not a joined resultset.

I don't know if you use a command with wich you get 3 times 3 tables, but
that for probably understandable reasons I never tried.

Would you not first try it with 3 dataadapters, which consumes nothing
extra.

Cor

"Rich" <Ri**@discussions.microsoft.com> schreef in bericht
news:34**********************************@microsof t.com...
Hi Cor,

Thank you for your reply to my question. I went to your website. I read
your article on Datagridview and datarelations. It looks like a great
article. I tried the example, but I was not able to get it to work. Here
is
what I tried (using VB2005):

...

'--note: I am only using 1 dataAdapter to fill my dataset
...
da.Fill(ds, "maintbl")
da.Fill(ds, "detail1")
da.Fill(ds, "detail2")

ds.Relations.Add("relDetail1", ds.tables("maintbl").columns("ID1"),
ds.Tables("detail1").columns("ID1"))
ds.Relations.Add("relDetail2", ds.Tables("maintbl").columns("ID2"),
ds.Tables("detail2").columns("ID2"))

'--note: maintable data is displayed in textboxes on the form. I iterate
through
'--maintbl and display 1 row of data at a time. I want to display the
related rows
'--in the datagridviews

datagridview1.Datasource = ds
datagridview2.datasource = ds

datagridview1.Datamember = "maintbl.relDetail1"
datagridview2.Datamember = "maintbl.relDetail2"

When I bring up the form, I see the data from maintbl in the textboxes on
the form, but there is no data in either of the datagridviews. May I
request
if you could see/explain what I am doing incorrectly?

Thanks,
Rich

"Cor Ligthert [MVP]" wrote:
Rich,

I remember me that the databinding I am talking about is with simple
controls in the reverse order as you want.

Here is almost exactly your problem although it goes 3 instead as you
need 2
deep.

http://www.vb-tips.com/dbpages.aspx?IA=DG

I hope this helps,

Cor
"Rich" <Ri**@discussions.microsoft.com> schreef in bericht
news:6A**********************************@microsof t.com...
>I decided to go ahead an experiment with DataRelations. Anyway, I am
>not
> getting any row filtering for the datagridviews. However, I do get
> rowfilter
> when I use the Dataview.Rowfilter property. So, does anyone have an
> understandable way to use DataRelations?
>
> "Rich" wrote:
>
>> 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 with databinding. The data from
>> the
>> 2
>> detail tables are displayed in 2 datagridviews. I filter each
>> datagridview
>> with a Dataview object using the dataview.Rowfilter property. This is
>> sort
>> of working except that I am getting an except on one of my detail
>> tables
>> (used to be no exceptions until I converted the detail tables into
>> views
>> on
>> the sql server - to simplify select command sql). So I was reading up
>> on
>> the
>> DataRelations object.
>>
>> Before I knock myself out changing all my client code, can I achieve
>> the
>> same row filtering functionality by using DataRelations instead of
>> Dataview.Rowfilter for the datagridviews? According to the reading, I
>> interpreted the reading to suggest that DataRelations are more
>> efficient -
>> but the only specified that it was more efficient than using a join
>> statement
>> in the select command. Any suggestions appreciated on if I should use
>> a
>> DataRelation vs Dataview.Rowfilter.
>>
>> Thanks,
>> Rich


May 24 '06 #8

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

Similar topics

4
by: Jim Heimer | last post by:
When I use the dataview.rowfilter and I try to display the field value of the first row, the code doesn't seem to show the first row AFTER the rowfilter. This is my code: DataView...
2
by: Jensen bredal | last post by:
Hello, I use The RowFilter property to select number of row from my dataview. How can i get the number of rows found ? I experience that the number of rows remains the same as before the...
3
by: Vern | last post by:
The following code retrieves data into a dataset, and then creates a dataview with a filter. This dataview is then attached to a combobox. When the effective date changes, I would like to see the...
3
by: Siegfried Heintze | last post by:
I'm displaying information on job postings in various cities. For example, might have a dozen jobs in Atlanta GA and I decide, at run time, that I don't want to see them. How do I set my DataView...
0
by: Coco | last post by:
Hi, who knows how to update the 'child' textboxes in a datarelated situation if the child records "doesn't yet exitsts/are still empty"? The problem can be explained with the Northwind database....
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...
7
by: randy1200 | last post by:
I have an orders table. Each record in the orders table contains a customer id. I have a customer table. The primary key of each record in the customer table is the customer id. After getting...
1
by: AlexW | last post by:
Hi I am in the process of developing an inventory application in visual basic. I keep coming up against a problem with using the dataview.rowfilter property. Basically what happens is this: -a...
5
by: AlexW | last post by:
Hi I am in the process of developing an inventory application in visual basic. I keep coming up against a problem with using the dataview.rowfilter property. Basically what happens is this: -a...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.