newbie - simple Master/Details question

G

Guest

Hi all,

I am a bit of "noob" when it comes to using c#.NET datagrids, and always
look at them in terms of what i could have done in VB6.

I have been reading around, and understand the ideas and logic of DataSets,
DataRelations, and DataTables. I understand how to populate a dataset,
datatable, grid etc, and have even got as displaying a combobox in cell of
the datagrid. However, I do not understand how to make relationships between
multiple tables appear as I want them on the screen.

For example, the following code I have used to populate data into a dataset,
and establish the relationships between the data tables. This works fine, no
problems:

sqlAdap=new SqlDataAdapter(strSearch,sqlConn);
SqlDataAdapter sqlAdap2 = new SqlDataAdapter("SELECT * FROM
T_Recycle_Consignment_Detail",sqlConn);

ds = new DataSet();
sqlAdap.Fill(ds,"T_Recycle_Consignment_Header");
sqlAdap2.Fill(ds,"T_Recycle_Consignment_Detail");

DataRelation Tran_Detail = new DataRelation("Items",
ds.Tables[0].Columns["F_Consignment_ID"],
ds.Tables[1].Columns["F_Consignment_ID"]);

ds.Relations.Add(Tran_Detail);


Where I am stuck, is that when I click on the "+" sign on the datagrid, I
first get a link to DataRelation name "Items", which when I click it, it
removes the parent grid, and just displays the child record(s).

Basically what I am after is the MSHFlexGrid from VB6, which my users have
always found really easy to use, and to understand.

Can anyone shed any light on this problem, or refer me any sites that
explain this?

Many thanks,

James.
 
G

Guest

Cor,

Thanks for the link, a very useful resource, well done.

I am trying to find a way of doing this in a single datagrid though, as the
MSHFlexGrid did in VB6. I know I can use the MSHFlexGrid component, but it
seems to me that the datarelations "should" do this anyway.

Just hoping someone can shed some light!

James.

Cor Ligthert said:
James,

One of the samples for this on our website.
http://www.vb-tips.com/dbpages.aspx?ID=a1a84750-08df-49b4-8657-7bc3068aca2c

To make it more complete is this one using 3 tables and 3 datagrids.

To find more go to the tab datagrid in Grids and select using the combobox
the others.

I hope this helps,

Cor

James Vickers said:
Hi all,

I am a bit of "noob" when it comes to using c#.NET datagrids, and always
look at them in terms of what i could have done in VB6.

I have been reading around, and understand the ideas and logic of
DataSets,
DataRelations, and DataTables. I understand how to populate a dataset,
datatable, grid etc, and have even got as displaying a combobox in cell of
the datagrid. However, I do not understand how to make relationships
between
multiple tables appear as I want them on the screen.

For example, the following code I have used to populate data into a
dataset,
and establish the relationships between the data tables. This works fine,
no
problems:

sqlAdap=new SqlDataAdapter(strSearch,sqlConn);
SqlDataAdapter sqlAdap2 = new SqlDataAdapter("SELECT * FROM
T_Recycle_Consignment_Detail",sqlConn);

ds = new DataSet();
sqlAdap.Fill(ds,"T_Recycle_Consignment_Header");
sqlAdap2.Fill(ds,"T_Recycle_Consignment_Detail");

DataRelation Tran_Detail = new DataRelation("Items",
ds.Tables[0].Columns["F_Consignment_ID"],
ds.Tables[1].Columns["F_Consignment_ID"]);

ds.Relations.Add(Tran_Detail);


Where I am stuck, is that when I click on the "+" sign on the datagrid, I
first get a link to DataRelation name "Items", which when I click it, it
removes the parent grid, and just displays the child record(s).

Basically what I am after is the MSHFlexGrid from VB6, which my users have
always found really easy to use, and to understand.

Can anyone shed any light on this problem, or refer me any sites that
explain this?

Many thanks,

James.
 
C

Cor Ligthert [MVP]

James,

Did you not see this one?

http://www.vb-tips.com/dbpages.aspx?ID=d55faa84-a853-4868-bdd8-ddebf666ce1e

I hope this helps,

Cor

James Vickers said:
Cor,

Thanks for the link, a very useful resource, well done.

I am trying to find a way of doing this in a single datagrid though, as
the
MSHFlexGrid did in VB6. I know I can use the MSHFlexGrid component, but it
seems to me that the datarelations "should" do this anyway.

Just hoping someone can shed some light!

James.

Cor Ligthert said:
James,

One of the samples for this on our website.
http://www.vb-tips.com/dbpages.aspx?ID=a1a84750-08df-49b4-8657-7bc3068aca2c

To make it more complete is this one using 3 tables and 3 datagrids.

To find more go to the tab datagrid in Grids and select using the
combobox
the others.

I hope this helps,

Cor

"James Vickers" <[email protected]> schreef in
bericht
Hi all,

I am a bit of "noob" when it comes to using c#.NET datagrids, and
always
look at them in terms of what i could have done in VB6.

I have been reading around, and understand the ideas and logic of
DataSets,
DataRelations, and DataTables. I understand how to populate a dataset,
datatable, grid etc, and have even got as displaying a combobox in cell
of
the datagrid. However, I do not understand how to make relationships
between
multiple tables appear as I want them on the screen.

For example, the following code I have used to populate data into a
dataset,
and establish the relationships between the data tables. This works
fine,
no
problems:

sqlAdap=new SqlDataAdapter(strSearch,sqlConn);
SqlDataAdapter sqlAdap2 = new SqlDataAdapter("SELECT * FROM
T_Recycle_Consignment_Detail",sqlConn);

ds = new DataSet();
sqlAdap.Fill(ds,"T_Recycle_Consignment_Header");
sqlAdap2.Fill(ds,"T_Recycle_Consignment_Detail");

DataRelation Tran_Detail = new DataRelation("Items",
ds.Tables[0].Columns["F_Consignment_ID"],
ds.Tables[1].Columns["F_Consignment_ID"]);

ds.Relations.Add(Tran_Detail);


Where I am stuck, is that when I click on the "+" sign on the datagrid,
I
first get a link to DataRelation name "Items", which when I click it,
it
removes the parent grid, and just displays the child record(s).

Basically what I am after is the MSHFlexGrid from VB6, which my users
have
always found really easy to use, and to understand.

Can anyone shed any light on this problem, or refer me any sites that
explain this?

Many thanks,

James.
 
G

Guest

Cor,

Thanks for the help, but....

This is what I have at the moment. Basically, I don't think having people
clicking hyperlinks, with very complicated navigation structures is the way
to go.

In MSHFlexGrid, the only navigation was the "+" button, and the scroll bar,
and this was ideal. Now, in this example, we have the "+" button, of which
you then have to choose the relation, and then get to the data. Once at that
data, you then have to remember for which row it was originally (unless you
can decipher what could be a very long list of column headings at the top of
the grid) and then figure out what the funny symbols in the top right-hand
corner of the screen are for - this is not going to work for my novice users
who are familiar with the MSHFlexGrid approach.

Is there no way to keep all the master records on the screen, and simply
expand the detail ones when the "+" is clicked? (and then allow them to be
collapsed again) I have seen implementations of this in ASP.NET, so it must
be able to be done???

James.

Cor Ligthert said:
James,

Did you not see this one?

http://www.vb-tips.com/dbpages.aspx?ID=d55faa84-a853-4868-bdd8-ddebf666ce1e

I hope this helps,

Cor

James Vickers said:
Cor,

Thanks for the link, a very useful resource, well done.

I am trying to find a way of doing this in a single datagrid though, as
the
MSHFlexGrid did in VB6. I know I can use the MSHFlexGrid component, but it
seems to me that the datarelations "should" do this anyway.

Just hoping someone can shed some light!

James.

Cor Ligthert said:
James,

One of the samples for this on our website.
http://www.vb-tips.com/dbpages.aspx?ID=a1a84750-08df-49b4-8657-7bc3068aca2c

To make it more complete is this one using 3 tables and 3 datagrids.

To find more go to the tab datagrid in Grids and select using the
combobox
the others.

I hope this helps,

Cor

"James Vickers" <[email protected]> schreef in
bericht
Hi all,

I am a bit of "noob" when it comes to using c#.NET datagrids, and
always
look at them in terms of what i could have done in VB6.

I have been reading around, and understand the ideas and logic of
DataSets,
DataRelations, and DataTables. I understand how to populate a dataset,
datatable, grid etc, and have even got as displaying a combobox in cell
of
the datagrid. However, I do not understand how to make relationships
between
multiple tables appear as I want them on the screen.

For example, the following code I have used to populate data into a
dataset,
and establish the relationships between the data tables. This works
fine,
no
problems:

sqlAdap=new SqlDataAdapter(strSearch,sqlConn);
SqlDataAdapter sqlAdap2 = new SqlDataAdapter("SELECT * FROM
T_Recycle_Consignment_Detail",sqlConn);

ds = new DataSet();
sqlAdap.Fill(ds,"T_Recycle_Consignment_Header");
sqlAdap2.Fill(ds,"T_Recycle_Consignment_Detail");

DataRelation Tran_Detail = new DataRelation("Items",
ds.Tables[0].Columns["F_Consignment_ID"],
ds.Tables[1].Columns["F_Consignment_ID"]);

ds.Relations.Add(Tran_Detail);


Where I am stuck, is that when I click on the "+" sign on the datagrid,
I
first get a link to DataRelation name "Items", which when I click it,
it
removes the parent grid, and just displays the child record(s).

Basically what I am after is the MSHFlexGrid from VB6, which my users
have
always found really easy to use, and to understand.

Can anyone shed any light on this problem, or refer me any sites that
explain this?

Many thanks,

James.
 
C

Cor Ligthert [MVP]

James,

As you have found that, can you than place a message here.

I have searched for that as well a long time, therefore I use now 2
datagrids above and below each other in those cases. (Although my idea was
before opposite from that, does it in my idea now works in fact even much
nicer (simpler) for both developing and enduser).

:)

Cor

James Vickers said:
Cor,

Thanks for the help, but....

This is what I have at the moment. Basically, I don't think having people
clicking hyperlinks, with very complicated navigation structures is the
way
to go.

In MSHFlexGrid, the only navigation was the "+" button, and the scroll
bar,
and this was ideal. Now, in this example, we have the "+" button, of which
you then have to choose the relation, and then get to the data. Once at
that
data, you then have to remember for which row it was originally (unless
you
can decipher what could be a very long list of column headings at the top
of
the grid) and then figure out what the funny symbols in the top right-hand
corner of the screen are for - this is not going to work for my novice
users
who are familiar with the MSHFlexGrid approach.

Is there no way to keep all the master records on the screen, and simply
expand the detail ones when the "+" is clicked? (and then allow them to be
collapsed again) I have seen implementations of this in ASP.NET, so it
must
be able to be done???

James.

Cor Ligthert said:
James,

Did you not see this one?

http://www.vb-tips.com/dbpages.aspx?ID=d55faa84-a853-4868-bdd8-ddebf666ce1e

I hope this helps,

Cor

"James Vickers" <[email protected]> schreef in
bericht
Cor,

Thanks for the link, a very useful resource, well done.

I am trying to find a way of doing this in a single datagrid though, as
the
MSHFlexGrid did in VB6. I know I can use the MSHFlexGrid component, but
it
seems to me that the datarelations "should" do this anyway.

Just hoping someone can shed some light!

James.

:

James,

One of the samples for this on our website.
http://www.vb-tips.com/dbpages.aspx?ID=a1a84750-08df-49b4-8657-7bc3068aca2c

To make it more complete is this one using 3 tables and 3 datagrids.

To find more go to the tab datagrid in Grids and select using the
combobox
the others.

I hope this helps,

Cor

"James Vickers" <[email protected]> schreef in
bericht
Hi all,

I am a bit of "noob" when it comes to using c#.NET datagrids, and
always
look at them in terms of what i could have done in VB6.

I have been reading around, and understand the ideas and logic of
DataSets,
DataRelations, and DataTables. I understand how to populate a
dataset,
datatable, grid etc, and have even got as displaying a combobox in
cell
of
the datagrid. However, I do not understand how to make relationships
between
multiple tables appear as I want them on the screen.

For example, the following code I have used to populate data into a
dataset,
and establish the relationships between the data tables. This works
fine,
no
problems:

sqlAdap=new SqlDataAdapter(strSearch,sqlConn);
SqlDataAdapter sqlAdap2 = new SqlDataAdapter("SELECT * FROM
T_Recycle_Consignment_Detail",sqlConn);

ds = new DataSet();
sqlAdap.Fill(ds,"T_Recycle_Consignment_Header");
sqlAdap2.Fill(ds,"T_Recycle_Consignment_Detail");

DataRelation Tran_Detail = new DataRelation("Items",
ds.Tables[0].Columns["F_Consignment_ID"],
ds.Tables[1].Columns["F_Consignment_ID"]);

ds.Relations.Add(Tran_Detail);


Where I am stuck, is that when I click on the "+" sign on the
datagrid,
I
first get a link to DataRelation name "Items", which when I click
it,
it
removes the parent grid, and just displays the child record(s).

Basically what I am after is the MSHFlexGrid from VB6, which my
users
have
always found really easy to use, and to understand.

Can anyone shed any light on this problem, or refer me any sites
that
explain this?

Many thanks,

James.
 
G

Guest

Cor,

I might have to try the 2 grid approach, and see if they like it.

Without looking through every link in my IE history for all the sites I been
to in the last week trying to find the ASP examples, one I remember is here:

http://www.denisbauer.com/ASPNETControls/HierarGrid.aspx

Which seemed quite nice. I hope this may be of use to you.

I'm still playing with master/detail at the moment, and have come accross a
new problem now! When I try to filter the parent table, i.e. alter it's SQL
to add WHERE clause(s) the tables error because their are then fields in the
child table (the detail) which has now records in the parent, so the
constraint fails.

I remember reading something about this before, about applying constratints,
so i'll have to look into that one next! Unless you know what it is!?

James.

Cor Ligthert said:
James,

As you have found that, can you than place a message here.

I have searched for that as well a long time, therefore I use now 2
datagrids above and below each other in those cases. (Although my idea was
before opposite from that, does it in my idea now works in fact even much
nicer (simpler) for both developing and enduser).

:)

Cor

James Vickers said:
Cor,

Thanks for the help, but....

This is what I have at the moment. Basically, I don't think having people
clicking hyperlinks, with very complicated navigation structures is the
way
to go.

In MSHFlexGrid, the only navigation was the "+" button, and the scroll
bar,
and this was ideal. Now, in this example, we have the "+" button, of which
you then have to choose the relation, and then get to the data. Once at
that
data, you then have to remember for which row it was originally (unless
you
can decipher what could be a very long list of column headings at the top
of
the grid) and then figure out what the funny symbols in the top right-hand
corner of the screen are for - this is not going to work for my novice
users
who are familiar with the MSHFlexGrid approach.

Is there no way to keep all the master records on the screen, and simply
expand the detail ones when the "+" is clicked? (and then allow them to be
collapsed again) I have seen implementations of this in ASP.NET, so it
must
be able to be done???

James.

Cor Ligthert said:
James,

Did you not see this one?

http://www.vb-tips.com/dbpages.aspx?ID=d55faa84-a853-4868-bdd8-ddebf666ce1e

I hope this helps,

Cor

"James Vickers" <[email protected]> schreef in
bericht
Cor,

Thanks for the link, a very useful resource, well done.

I am trying to find a way of doing this in a single datagrid though, as
the
MSHFlexGrid did in VB6. I know I can use the MSHFlexGrid component, but
it
seems to me that the datarelations "should" do this anyway.

Just hoping someone can shed some light!

James.

:

James,

One of the samples for this on our website.
http://www.vb-tips.com/dbpages.aspx?ID=a1a84750-08df-49b4-8657-7bc3068aca2c

To make it more complete is this one using 3 tables and 3 datagrids.

To find more go to the tab datagrid in Grids and select using the
combobox
the others.

I hope this helps,

Cor

"James Vickers" <[email protected]> schreef in
bericht
Hi all,

I am a bit of "noob" when it comes to using c#.NET datagrids, and
always
look at them in terms of what i could have done in VB6.

I have been reading around, and understand the ideas and logic of
DataSets,
DataRelations, and DataTables. I understand how to populate a
dataset,
datatable, grid etc, and have even got as displaying a combobox in
cell
of
the datagrid. However, I do not understand how to make relationships
between
multiple tables appear as I want them on the screen.

For example, the following code I have used to populate data into a
dataset,
and establish the relationships between the data tables. This works
fine,
no
problems:

sqlAdap=new SqlDataAdapter(strSearch,sqlConn);
SqlDataAdapter sqlAdap2 = new SqlDataAdapter("SELECT * FROM
T_Recycle_Consignment_Detail",sqlConn);

ds = new DataSet();
sqlAdap.Fill(ds,"T_Recycle_Consignment_Header");
sqlAdap2.Fill(ds,"T_Recycle_Consignment_Detail");

DataRelation Tran_Detail = new DataRelation("Items",
ds.Tables[0].Columns["F_Consignment_ID"],
ds.Tables[1].Columns["F_Consignment_ID"]);

ds.Relations.Add(Tran_Detail);


Where I am stuck, is that when I click on the "+" sign on the
datagrid,
I
first get a link to DataRelation name "Items", which when I click
it,
it
removes the parent grid, and just displays the child record(s).

Basically what I am after is the MSHFlexGrid from VB6, which my
users
have
always found really easy to use, and to understand.

Can anyone shed any light on this problem, or refer me any sites
that
explain this?

Many thanks,

James.
 
C

Cor Ligthert [MVP]

James,

Why do you not use the same Where clause for the childs?

Cor

James Vickers said:
Cor,

I might have to try the 2 grid approach, and see if they like it.

Without looking through every link in my IE history for all the sites I
been
to in the last week trying to find the ASP examples, one I remember is
here:

http://www.denisbauer.com/ASPNETControls/HierarGrid.aspx

Which seemed quite nice. I hope this may be of use to you.

I'm still playing with master/detail at the moment, and have come accross
a
new problem now! When I try to filter the parent table, i.e. alter it's
SQL
to add WHERE clause(s) the tables error because their are then fields in
the
child table (the detail) which has now records in the parent, so the
constraint fails.

I remember reading something about this before, about applying
constratints,
so i'll have to look into that one next! Unless you know what it is!?

James.

Cor Ligthert said:
James,

As you have found that, can you than place a message here.

I have searched for that as well a long time, therefore I use now 2
datagrids above and below each other in those cases. (Although my idea
was
before opposite from that, does it in my idea now works in fact even much
nicer (simpler) for both developing and enduser).

:)

Cor

"James Vickers" <[email protected]> schreef in
bericht
Cor,

Thanks for the help, but....

This is what I have at the moment. Basically, I don't think having
people
clicking hyperlinks, with very complicated navigation structures is the
way
to go.

In MSHFlexGrid, the only navigation was the "+" button, and the scroll
bar,
and this was ideal. Now, in this example, we have the "+" button, of
which
you then have to choose the relation, and then get to the data. Once at
that
data, you then have to remember for which row it was originally (unless
you
can decipher what could be a very long list of column headings at the
top
of
the grid) and then figure out what the funny symbols in the top
right-hand
corner of the screen are for - this is not going to work for my novice
users
who are familiar with the MSHFlexGrid approach.

Is there no way to keep all the master records on the screen, and
simply
expand the detail ones when the "+" is clicked? (and then allow them to
be
collapsed again) I have seen implementations of this in ASP.NET, so it
must
be able to be done???

James.

:

James,

Did you not see this one?

http://www.vb-tips.com/dbpages.aspx?ID=d55faa84-a853-4868-bdd8-ddebf666ce1e

I hope this helps,

Cor

"James Vickers" <[email protected]> schreef in
bericht
Cor,

Thanks for the link, a very useful resource, well done.

I am trying to find a way of doing this in a single datagrid though,
as
the
MSHFlexGrid did in VB6. I know I can use the MSHFlexGrid component,
but
it
seems to me that the datarelations "should" do this anyway.

Just hoping someone can shed some light!

James.

:

James,

One of the samples for this on our website.
http://www.vb-tips.com/dbpages.aspx?ID=a1a84750-08df-49b4-8657-7bc3068aca2c

To make it more complete is this one using 3 tables and 3
datagrids.

To find more go to the tab datagrid in Grids and select using the
combobox
the others.

I hope this helps,

Cor

"James Vickers" <[email protected]> schreef in
bericht
Hi all,

I am a bit of "noob" when it comes to using c#.NET datagrids, and
always
look at them in terms of what i could have done in VB6.

I have been reading around, and understand the ideas and logic of
DataSets,
DataRelations, and DataTables. I understand how to populate a
dataset,
datatable, grid etc, and have even got as displaying a combobox
in
cell
of
the datagrid. However, I do not understand how to make
relationships
between
multiple tables appear as I want them on the screen.

For example, the following code I have used to populate data into
a
dataset,
and establish the relationships between the data tables. This
works
fine,
no
problems:

sqlAdap=new SqlDataAdapter(strSearch,sqlConn);
SqlDataAdapter sqlAdap2 = new SqlDataAdapter("SELECT * FROM
T_Recycle_Consignment_Detail",sqlConn);

ds = new DataSet();
sqlAdap.Fill(ds,"T_Recycle_Consignment_Header");
sqlAdap2.Fill(ds,"T_Recycle_Consignment_Detail");

DataRelation Tran_Detail = new DataRelation("Items",
ds.Tables[0].Columns["F_Consignment_ID"],
ds.Tables[1].Columns["F_Consignment_ID"]);

ds.Relations.Add(Tran_Detail);


Where I am stuck, is that when I click on the "+" sign on the
datagrid,
I
first get a link to DataRelation name "Items", which when I click
it,
it
removes the parent grid, and just displays the child record(s).

Basically what I am after is the MSHFlexGrid from VB6, which my
users
have
always found really easy to use, and to understand.

Can anyone shed any light on this problem, or refer me any sites
that
explain this?

Many thanks,

James.
 
G

Guest

Cor,

I found out that, as you have noted here, the error message is due to the
fact that there are too many child rows for the parent (i.e. none matching
ones) and as such the two tables won't bind.

I changed the way I handle my SQL, and made the child table's SQL statement
a sub-select, and did it that way. I wouldn't just add a where, because the
fields being searched upon in the parent, don't occur in the child - it got
quite complicated at that stage. Anyway, the SELECT bla FROM bla WHERE field
IN (SELECT bla FROM bla) worked a treat.

James.

Cor Ligthert said:
James,

Why do you not use the same Where clause for the childs?

Cor

James Vickers said:
Cor,

I might have to try the 2 grid approach, and see if they like it.

Without looking through every link in my IE history for all the sites I
been
to in the last week trying to find the ASP examples, one I remember is
here:

http://www.denisbauer.com/ASPNETControls/HierarGrid.aspx

Which seemed quite nice. I hope this may be of use to you.

I'm still playing with master/detail at the moment, and have come accross
a
new problem now! When I try to filter the parent table, i.e. alter it's
SQL
to add WHERE clause(s) the tables error because their are then fields in
the
child table (the detail) which has now records in the parent, so the
constraint fails.

I remember reading something about this before, about applying
constratints,
so i'll have to look into that one next! Unless you know what it is!?

James.

Cor Ligthert said:
James,

As you have found that, can you than place a message here.

I have searched for that as well a long time, therefore I use now 2
datagrids above and below each other in those cases. (Although my idea
was
before opposite from that, does it in my idea now works in fact even much
nicer (simpler) for both developing and enduser).

:)

Cor

"James Vickers" <[email protected]> schreef in
bericht
Cor,

Thanks for the help, but....

This is what I have at the moment. Basically, I don't think having
people
clicking hyperlinks, with very complicated navigation structures is the
way
to go.

In MSHFlexGrid, the only navigation was the "+" button, and the scroll
bar,
and this was ideal. Now, in this example, we have the "+" button, of
which
you then have to choose the relation, and then get to the data. Once at
that
data, you then have to remember for which row it was originally (unless
you
can decipher what could be a very long list of column headings at the
top
of
the grid) and then figure out what the funny symbols in the top
right-hand
corner of the screen are for - this is not going to work for my novice
users
who are familiar with the MSHFlexGrid approach.

Is there no way to keep all the master records on the screen, and
simply
expand the detail ones when the "+" is clicked? (and then allow them to
be
collapsed again) I have seen implementations of this in ASP.NET, so it
must
be able to be done???

James.

:

James,

Did you not see this one?

http://www.vb-tips.com/dbpages.aspx?ID=d55faa84-a853-4868-bdd8-ddebf666ce1e

I hope this helps,

Cor

"James Vickers" <[email protected]> schreef in
bericht
Cor,

Thanks for the link, a very useful resource, well done.

I am trying to find a way of doing this in a single datagrid though,
as
the
MSHFlexGrid did in VB6. I know I can use the MSHFlexGrid component,
but
it
seems to me that the datarelations "should" do this anyway.

Just hoping someone can shed some light!

James.

:

James,

One of the samples for this on our website.
http://www.vb-tips.com/dbpages.aspx?ID=a1a84750-08df-49b4-8657-7bc3068aca2c

To make it more complete is this one using 3 tables and 3
datagrids.

To find more go to the tab datagrid in Grids and select using the
combobox
the others.

I hope this helps,

Cor

"James Vickers" <[email protected]> schreef in
bericht
Hi all,

I am a bit of "noob" when it comes to using c#.NET datagrids, and
always
look at them in terms of what i could have done in VB6.

I have been reading around, and understand the ideas and logic of
DataSets,
DataRelations, and DataTables. I understand how to populate a
dataset,
datatable, grid etc, and have even got as displaying a combobox
in
cell
of
the datagrid. However, I do not understand how to make
relationships
between
multiple tables appear as I want them on the screen.

For example, the following code I have used to populate data into
a
dataset,
and establish the relationships between the data tables. This
works
fine,
no
problems:

sqlAdap=new SqlDataAdapter(strSearch,sqlConn);
SqlDataAdapter sqlAdap2 = new SqlDataAdapter("SELECT * FROM
T_Recycle_Consignment_Detail",sqlConn);

ds = new DataSet();
sqlAdap.Fill(ds,"T_Recycle_Consignment_Header");
sqlAdap2.Fill(ds,"T_Recycle_Consignment_Detail");

DataRelation Tran_Detail = new DataRelation("Items",
ds.Tables[0].Columns["F_Consignment_ID"],
ds.Tables[1].Columns["F_Consignment_ID"]);

ds.Relations.Add(Tran_Detail);


Where I am stuck, is that when I click on the "+" sign on the
datagrid,
I
first get a link to DataRelation name "Items", which when I click
it,
it
removes the parent grid, and just displays the child record(s).

Basically what I am after is the MSHFlexGrid from VB6, which my
users
have
always found really easy to use, and to understand.

Can anyone shed any light on this problem, or refer me any sites
that
explain this?

Many thanks,

James.
 

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