473,378 Members | 1,417 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.

getting 'real' table datasource from grandchild datagrid that is based on dataview

I have a datagrid that is two levels down from the dataview (i.e.
grandchild). I have spent 3 hours trying to get the syntax of determining
it's real datasource (i.e. not it's source based on it's relationship with
the dataview).

argh!

company
---> person
--->contact
-contact is the 'real' datasource for the grid
-company is a dataview used to populate several text controls on the form
and is the binder that the navigation ctrls use.
-the datagrid binds to the dataview with the datamember set to
"companyPerson.PersonContact" which of course is the relationship name
between the dv and the grandchild table.

Of course - if is do the following:
mydatatable = ctype(me.mydatagrid, dataview).table.tablename I get the
Company table! which is NOT what I need.

Is there a simple way of determing that the underlying table my datagrid is
hitting is 'contact' ?

Thank you.
Nov 21 '05 #1
3 1602
Astro,

From a parent row you can get the childcollection of datarows.

http://msdn.microsoft.com/library/de...drowstopic.asp

In a datarow you can find in what table it is.
dr.table

That table is the complete table not the collection of the datarows which
are in the relation.

I hope this helps,

Cor

"astro" <as***@mnrr.com> schreef in bericht
news:5M*********************@tornado.rdc-kc.rr.com...
I have a datagrid that is two levels down from the dataview (i.e.
grandchild). I have spent 3 hours trying to get the syntax of determining
it's real datasource (i.e. not it's source based on it's relationship with
the dataview).

argh!

company
---> person
--->contact
-contact is the 'real' datasource for the grid
-company is a dataview used to populate several text controls on the form
and is the binder that the navigation ctrls use.
-the datagrid binds to the dataview with the datamember set to
"companyPerson.PersonContact" which of course is the relationship name
between the dv and the grandchild table.

Of course - if is do the following:
mydatatable = ctype(me.mydatagrid, dataview).table.tablename I get the
Company table! which is NOT what I need.

Is there a simple way of determing that the underlying table my datagrid
is hitting is 'contact' ?

Thank you.

Nov 21 '05 #2
Hi,

"astro" <as***@mnrr.com> wrote in message
news:5M*********************@tornado.rdc-kc.rr.com...
I have a datagrid that is two levels down from the dataview (i.e.
grandchild). I have spent 3 hours trying to get the syntax of determining
it's real datasource (i.e. not it's source based on it's relationship with
the dataview).
Why say "real" datasource ? When you bind the DataGrid to a DataView and set
DataMember to "relation1.relation2" then it's still using the original
grandchild DataTable (got from da.Fill). There is a DataView inbetween used
to filter the child rows depending on the current parent row.

You can get the DataView for the visible DataTable in the DataGrid
(grandchild in this case) using the CurrencyManager:

Dim cm as CurrencyManager = DirectCast( _
BindingContext( mygrid.DataSource, _
mygrid.DataMember ), CurrencyManager )

Dim currentDataView As DataView = _
DirectCast( cm.List, DataView )

Dim currentDataTable As DataTable = _
currentDataView.Table
Now, currentDataTable is the same DataTable as the one you can get from the
DataView DataSource and the Relations.
hth,
greetings


argh!

company
---> person
--->contact
-contact is the 'real' datasource for the grid
-company is a dataview used to populate several text controls on the form
and is the binder that the navigation ctrls use.
-the datagrid binds to the dataview with the datamember set to
"companyPerson.PersonContact" which of course is the relationship name
between the dv and the grandchild table.

Of course - if is do the following:
mydatatable = ctype(me.mydatagrid, dataview).table.tablename I get the
Company table! which is NOT what I need.

Is there a simple way of determing that the underlying table my datagrid
is hitting is 'contact' ?

Thank you.

Nov 21 '05 #3
Thanks Cor and Bart - I decided to just avoid this problem by adding the
tablename to the tag property of each datagrid on this form.

I have saved your comments and will tackle this issue on project #2.

)
"astro" <as***@mnrr.com> wrote in message
news:5M*********************@tornado.rdc-kc.rr.com...
I have a datagrid that is two levels down from the dataview (i.e.
grandchild). I have spent 3 hours trying to get the syntax of determining
it's real datasource (i.e. not it's source based on it's relationship with
the dataview).

argh!

company
---> person
--->contact
-contact is the 'real' datasource for the grid
-company is a dataview used to populate several text controls on the form
and is the binder that the navigation ctrls use.
-the datagrid binds to the dataview with the datamember set to
"companyPerson.PersonContact" which of course is the relationship name
between the dv and the grandchild table.

Of course - if is do the following:
mydatatable = ctype(me.mydatagrid, dataview).table.tablename I get the
Company table! which is NOT what I need.

Is there a simple way of determing that the underlying table my datagrid
is hitting is 'contact' ?

Thank you.

Nov 21 '05 #4

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

Similar topics

3
by: sam | last post by:
Hello group, The datagrid is sorted using a dataview. Can I get the sorted dataview or table from the datagrid or any other way. All I need to get is the sorted data. Here is my code and what I am...
3
by: Dan V. | last post by:
How can I use real SQL on a DataTable? i.e. not array of rows using a filter... as in DataTable.Select. I read at : microsoft.public.dotnet.framework.adonet "As others have posted: There is no...
4
by: - R | last post by:
Hello all. I'm new to .Net so please help me out. I have a application with several "Threads" running to observe various things. From time to time each thread need to add an log entry, which...
5
by: Jason | last post by:
I've been trying to figure out a good way to do this but haven't had much luck, any input would be greatly appreciated. Basically, after a datagrid is sorted, how can I get the primary key value...
8
by: ASP Yaboh | last post by:
I have an ArrayList of data gathered from a database. I want to create a web page from this data by creating a <table>, each cell in each row displays the appropriate data. One of those cells in...
1
by: Gunjan Garg | last post by:
Hello All, I am working to create a generic datagrid which accepts a datasource(ListData - This is our own datatype) and depending on the calling program customizes itself for sorting,...
4
by: jaYPee | last post by:
I have 1 dataset called "dataset1" that contains 2 tables called "course" and "courseload". in my form i have a datagrid. the datasource of this datagrid is "dataset1" and the datamember is...
4
by: Richard Fagen | last post by:
Hi, I wondering if someone can explain the best way to show three datagrids in a parent/child/grandchild relationship? For example: Take a simple form with 3 datagrids - the top for the...
7
by: Brett Romero | last post by:
I've created a custom datagrid and would like to get only entries displaying in the grid. The datasource may be a table or dataview. So I check for this in the custom datagrid class: if...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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 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.