473,398 Members | 2,368 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.

Help: DataRelation object

Dear all,

I have a dataset which contains 2 DataTable
The idea is to bind a text box control with one table field and then
diaplaye the associated content of the second table based on the first table
entry.

For that I have been guide to use data relation bettween those two table.
The following code illustrate what I have done :

----->

ds.Tables.AddRange(New DataTable() {tblCustomer, tblApplication})

' Create a DataRelation, and add it to the DataSet.
Dim dr As DataRelation
dr = New DataRelation("custToApp",
tblCustomer.Columns.Item("ORDER"), tblApplication.Columns.Item("ORDER_ID"))
ds.Relations.Add(dr)

Me.ListBox1.DataSource = ds.Tables("CUSTOMER")
Me.TextBox1.DataBindings.Add(New Binding("Text", tblCustomer, "NAME"))

DataGrid1.Visible = True
DataGrid1.DataSource = ds.Tables(1)

---->

As a result I was expected that for the first entry of customer table, the
correponding appication records for that customer gets displayed in the
datagrid, becasue of this relation ojbect.

But insatead in the datagrid I get all records of my application table and
not only the one from one customer name.

What I am doing wrong or did not understand complety. As far as I understand
realtion between 2 coluumns from 2 different table should displayed only
related information..

Thnaks fro your help
serge
Jul 21 '05 #1
3 1549
Serge,

You have to bind the relation to the datagrid.

Cor
Jul 21 '05 #2
HOw to bind the relation to the datagrid ?

The relation is bind to the dataset, which is linked to the datasource of
the datagrid
Does it not the same?

thansk for your info

"Cor Ligthert" wrote:
Serge,

You have to bind the relation to the datagrid.

Cor

Jul 21 '05 #3
Serge,
Serge

Probably however I am always figthing with this one.

DataGrid1.SetDataBinding(ds, "tblCustomers.custToApp")

I hope this helps,

Cor
Jul 21 '05 #4

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
0
by: Paul | last post by:
Hi, I think there's a bug in the ComoBox when binding to a DataRelation. The problem is that SelectedValueChanged event is not always being called. Here is some code to reproduce the problem....
0
by: MG | last post by:
Hello All, I'm getting this error on a ASP .NET apps: Index 2 is not non-negative and below total rows count. Line 443: Line 444: Dim ParentTableView As New...
3
by: serge calderara | last post by:
Dear all, I have a dataset which contains 2 DataTable The idea is to bind a text box control with one table field and then diaplaye the associated content of the second table based on the first...
0
by: frank | last post by:
I have several tables that have a one to one relationship. I have DataRelation objects to define these relationships. I would like to bind the DataRelation to both a gridview and a formview so...
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...
6
by: Aryan | last post by:
Hi, I want to use DataRelation object for setting up relationship between two different datatable, but i want to use multiple columns to set up relation between two tables. For example. ...
0
by: KA NMC | last post by:
I have One Datagrid with a dataset that calls two tables - the First table is the table the user will be editing - which edited on the grid or in a textbox - as the user edits the grid - that info is...
2
by: Tony Johansson | last post by:
Hello! I can't understand what is this table DataRelation used for. I mean as long as you have this DataTable I can't see any point in using this DataRelation. //Tony
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: 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...
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.