Columns in a Dataview

M

Mike

I have a table that is composed of an ID and two foreign keys. This table is
used to relate two other tables.

I'm using a dataview to display the data. The data can be edited, including
changed, deleted and added.

How should I set up the dataview columns so the user sees the choices from
the two tables, but the third table (with the foreign keys) is filled in
with the ID's from the two tables?

Example tables:

tbOne [OneID, OneDataField]
tbTwo [TwoID, TwoDataField]
tbThree [ThreeID, OneID, TwoID]

I want the user to see OneDataField and TwoDataField in the dataview. If the
value of OneDataField is not present in tbOne, then it needs to be added to
tbOne. If the value of TwoDataField is not present in tbTwo, then it needs
to be added to tbTwo. Finally, the ID for OneDataField and TwoDataField
needs to be inserted in a new row in tbThree.

I'm pretty sure I can do this - I just don't know how.

Thanks so much for your help.
Mike
 
C

Cor Ligthert [MVP]

Mike,

You cannot set up columns in a dataview, you can use those.
A dataview is a complete view on your table, there are for every control
enough possibilites to select the right one(s).

In version 2.0 you can create a *new* table with your columns, but that you
cannot use to update or whatever your original tables.

I hope this helps,

Cor
 
M

Mike

Cor,

Thank you for your response. However, I must give you my apologies because I
gave the wrong information.

Where you read DataView below, change it to DataGridView. I think that makes
a big difference. :)

Thanks!
Mike

Cor Ligthert said:
Mike,

You cannot set up columns in a dataview, you can use those.
A dataview is a complete view on your table, there are for every control
enough possibilites to select the right one(s).

In version 2.0 you can create a *new* table with your columns, but that
you cannot use to update or whatever your original tables.

I hope this helps,

Cor

Mike said:
I have a table that is composed of an ID and two foreign keys. This table
is used to relate two other tables.

I'm using a dataview to display the data. The data can be edited,
including changed, deleted and added.

How should I set up the dataview columns so the user sees the choices
from the two tables, but the third table (with the foreign keys) is
filled in with the ID's from the two tables?

Example tables:

tbOne [OneID, OneDataField]
tbTwo [TwoID, TwoDataField]
tbThree [ThreeID, OneID, TwoID]

I want the user to see OneDataField and TwoDataField in the dataview. If
the value of OneDataField is not present in tbOne, then it needs to be
added to tbOne. If the value of TwoDataField is not present in tbTwo,
then it needs to be added to tbTwo. Finally, the ID for OneDataField and
TwoDataField needs to be inserted in a new row in tbThree.

I'm pretty sure I can do this - I just don't know how.

Thanks so much for your help.
Mike
 
C

Cor Ligthert [MVP]

Mike,

That goes in windows forms for datagrids forever with columns.

I see that I have not direct a sample for you where they are made on the fly
for a datatable probably Ken or I will make that very soon.

Cor




Mike said:
Cor,

Thank you for your response. However, I must give you my apologies because
I gave the wrong information.

Where you read DataView below, change it to DataGridView. I think that
makes a big difference. :)

Thanks!
Mike

Cor Ligthert said:
Mike,

You cannot set up columns in a dataview, you can use those.
A dataview is a complete view on your table, there are for every control
enough possibilites to select the right one(s).

In version 2.0 you can create a *new* table with your columns, but that
you cannot use to update or whatever your original tables.

I hope this helps,

Cor

Mike said:
I have a table that is composed of an ID and two foreign keys. This table
is used to relate two other tables.

I'm using a dataview to display the data. The data can be edited,
including changed, deleted and added.

How should I set up the dataview columns so the user sees the choices
from the two tables, but the third table (with the foreign keys) is
filled in with the ID's from the two tables?

Example tables:

tbOne [OneID, OneDataField]
tbTwo [TwoID, TwoDataField]
tbThree [ThreeID, OneID, TwoID]

I want the user to see OneDataField and TwoDataField in the dataview. If
the value of OneDataField is not present in tbOne, then it needs to be
added to tbOne. If the value of TwoDataField is not present in tbTwo,
then it needs to be added to tbTwo. Finally, the ID for OneDataField and
TwoDataField needs to be inserted in a new row in tbThree.

I'm pretty sure I can do this - I just don't know how.

Thanks so much for your help.
Mike
 

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