?
Solved

Adding a calculated column to datatable based on Parent field.

Posted on 2004-04-17
2
Medium Priority
?
1,359 Views
Last Modified: 2008-01-16
Hi,
I'm trying to create a calculated column in a datatable which puts in the value of a field from a parent table.
I'm working with the following tables from my db: custOrders, Customer
Essentially I just want to bind a combo box to the customerName field which is Parent in the relation with custOrders.

Code:
'Add Relationship
r = New DataRelation("Customer-custOrder", ds.Tables("Customer").Columns(0),                                                 ds.Tables("custOrders").Columns(1))

ds.Relations.Add(r)

'Add Column
ds.Tables("custOrders").Columns.Add("cName", GetType(String), "Parent(Customer-custOrder).customerName")

'Add Binding
lblCust.DataBindings.Add("Text", ds, "custOrders.cName")

The problem is with "Parent(Customer-custOrder).customerName"
It complains when I try to specify the relationship name (like I have here). If I have only one parent relationship on the custOrders table then I don't need to specify the relationship name and it works - but I have more than one parent relationship.

The error is:
Syntax error in Lookup expression: Expecting keyword 'Parent' followed by a single column argument with possible relation qualifier: Parent[(<relation_name>)].<column_name>.

I have tried putting the relationship name in quotes and I get the same error.

Is there a better way to bind to the parent field, or how can I get the column add function to work?

Thanks
0
Comment
Question by:Tiare
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 3

Accepted Solution

by:
Lektran earned 2000 total points
ID: 10852627
have you tried taking the '-' out of the relation name?
0
 

Author Comment

by:Tiare
ID: 10855474
Haha, so simple.

Thanks mate.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question