Columns from two tables in one datagridview row


P

Paul Craig

Hi,
Im using Visual Studio 2005 and playing around with all the new ADO .Net 2.0
features, I am hoping that what I am chasing is now available. I am wanting
to display an updatable row (don't need insert or delete) which displays
columns from two tables which have a one to one relationship. The following
is the sql query which produces exactly what I am after:

SELECT d_client.client_id, d_client.client_status,
d_client_members.member_id, d_client_members.phone_mobile
FROM d_client LEFT OUTER JOIN
d_client_members ON d_client.client_id =
d_client_members.client_id
WHERE (d_client_members.flag_primary_contact = 1) OR
(d_client_members.flag_primary_contact IS NULL)

I have run this query in sql server and it returns 1 row per client which is
exactly what I want.

In vs 2005 im not sure how to use this query correctly so instead I have set
the relationship up between the two tables and used seperate select queries
in each table in the dataset designer. When I set the datagridview to the
d_client binding source, i get a parent row with the d_client information
and then a child row with the d_client_members details. I know I am doing
something wrong here but all the new features have me a little
overwhelmed...

Any help will be greatly apprecaited
Cheers
Paul
 
Ad

Advertisements

C

Cor Ligthert [MVP]

Paul,

If it is right, than a join should AFAIK return one table.

Cor
 
Ad

Advertisements

H

H5N1

That's true, but all data source wizards won't generate UPDATE methods
for multitable queries, so databinding would be read-only.

How to make it bi-directional?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top