Home All Groups Group Topic Archive Search About

disconnected typed dataset

Author
13 Apr 2005 2:22 PM
TLWood

Hi

I am creating a multi-user db app in VB.NET 2003 which accesses a remote SQL
Server. The db has many tables related hierarchically. At the start of a
session I want to get a selected set of data into a dataset, work with it
extensively and put it back dealing with any conflicts at this time.

My question is, how do I manupulate the data from the dataset to display it?
What I really want to do is create a multi-table view of some of the data in
the dataset and display it in a datagrid or similar. The normal hierarchical
view of data in the datagrid is not user friendly enough - I need to display
read-only rows of Customers each having several Addresses (related via IDs
from a different table) each in a separate row allowing the user to select a
row (Customer/Address pair) and edit it elsewhere.

Any help or pointers would be much appreciated.

--
Many Thanks
Terry

Author
13 Apr 2005 2:56 PM
Alex Passos
Hi Terry, look into using a DataGrid, it has exactly everything you need.
Just attach the data set to the DataGrid.DataSource member and go from
there.

Alex

Show quoteHide quote
"TLWood" <volvo340@newsgroup.nospam> wrote in message
news:3643D60B-9D07-4068-ACA1-D8965BD5E464@microsoft.com...
> Hi
>
> I am creating a multi-user db app in VB.NET 2003 which accesses a remote
> SQL
> Server. The db has many tables related hierarchically. At the start of a
> session I want to get a selected set of data into a dataset, work with it
> extensively and put it back dealing with any conflicts at this time.
>
> My question is, how do I manupulate the data from the dataset to display
> it?
> What I really want to do is create a multi-table view of some of the data
> in
> the dataset and display it in a datagrid or similar. The normal
> hierarchical
> view of data in the datagrid is not user friendly enough - I need to
> display
> read-only rows of Customers each having several Addresses (related via IDs
> from a different table) each in a separate row allowing the user to select
> a
> row (Customer/Address pair) and edit it elsewhere.
>
> Any help or pointers would be much appreciated.
>
> --
> Many Thanks
> Terry
Are all your drivers up to date? click for free checkup

Author
13 Apr 2005 5:16 PM
TLWood
Thanks Alex

I have had a look into the datagrid, but it only seems to display one table
at a time. In order to display fields from multiple tables on the same row a
new query needs to be performed which combines the tables. This would be OK
for a connected recordset, but for a disconnected dataset this cannot be
achieved since another trip to the database is not possible. I therefore need
some way to get the data out of 2 tables in the dataset into the same row in
the datagrid. Any ideas?

Show quoteHide quote
"Alex Passos" wrote:

> Hi Terry, look into using a DataGrid, it has exactly everything you need.
> Just attach the data set to the DataGrid.DataSource member and go from
> there.
>
> Alex
>
> "TLWood" <volvo340@newsgroup.nospam> wrote in message
> news:3643D60B-9D07-4068-ACA1-D8965BD5E464@microsoft.com...
> > Hi
> >
> > I am creating a multi-user db app in VB.NET 2003 which accesses a remote
> > SQL
> > Server. The db has many tables related hierarchically. At the start of a
> > session I want to get a selected set of data into a dataset, work with it
> > extensively and put it back dealing with any conflicts at this time.
> >
> > My question is, how do I manupulate the data from the dataset to display
> > it?
> > What I really want to do is create a multi-table view of some of the data
> > in
> > the dataset and display it in a datagrid or similar. The normal
> > hierarchical
> > view of data in the datagrid is not user friendly enough - I need to
> > display
> > read-only rows of Customers each having several Addresses (related via IDs
> > from a different table) each in a separate row allowing the user to select
> > a
> > row (Customer/Address pair) and edit it elsewhere.
> >
> > Any help or pointers would be much appreciated.
> >
> > --
> > Many Thanks
> > Terry
>
>
>
Author
13 Apr 2005 5:18 PM
Alex Passos
Look into DataSet.Merge, you can merge two datasets in that manner and
append the columns for those that are not present as long as the sets share
the same primary key.  Then plug it into DataGrid.

Alex

Show quoteHide quote
"TLWood" <volvo340@newsgroup.nospam> wrote in message
news:84AF6226-2E5B-4D2D-BBF3-E30BAB03B0A0@microsoft.com...
> Thanks Alex
>
> I have had a look into the datagrid, but it only seems to display one
> table
> at a time. In order to display fields from multiple tables on the same row
> a
> new query needs to be performed which combines the tables. This would be
> OK
> for a connected recordset, but for a disconnected dataset this cannot be
> achieved since another trip to the database is not possible. I therefore
> need
> some way to get the data out of 2 tables in the dataset into the same row
> in
> the datagrid. Any ideas?
>
> "Alex Passos" wrote:
>
>> Hi Terry, look into using a DataGrid, it has exactly everything you need.
>> Just attach the data set to the DataGrid.DataSource member and go from
>> there.
>>
>> Alex
>>
>> "TLWood" <volvo340@newsgroup.nospam> wrote in message
>> news:3643D60B-9D07-4068-ACA1-D8965BD5E464@microsoft.com...
>> > Hi
>> >
>> > I am creating a multi-user db app in VB.NET 2003 which accesses a
>> > remote
>> > SQL
>> > Server. The db has many tables related hierarchically. At the start of
>> > a
>> > session I want to get a selected set of data into a dataset, work with
>> > it
>> > extensively and put it back dealing with any conflicts at this time.
>> >
>> > My question is, how do I manupulate the data from the dataset to
>> > display
>> > it?
>> > What I really want to do is create a multi-table view of some of the
>> > data
>> > in
>> > the dataset and display it in a datagrid or similar. The normal
>> > hierarchical
>> > view of data in the datagrid is not user friendly enough - I need to
>> > display
>> > read-only rows of Customers each having several Addresses (related via
>> > IDs
>> > from a different table) each in a separate row allowing the user to
>> > select
>> > a
>> > row (Customer/Address pair) and edit it elsewhere.
>> >
>> > Any help or pointers would be much appreciated.
>> >
>> > --
>> > Many Thanks
>> > Terry
>>
>>
>>
Author
13 Apr 2005 6:14 PM
TLWood
Would this mean that I would have to put each table into a separate Dataset?
This is a fairly comprehensive system with around 80 tables so the thought of
manually setting up relationships (if this is possible) between all these
separate datasets is pretty daunting. I was hoping that I was missing
something obvious!

It would be handy if there was a sort of multi-table View that can be done
on a dataset. If I add a combined new table to the dataset with the required
fields from multiple other tables, is there a sleek way of automatically
updating it if the source tables are updated without resorting to the old
fashioned manual approach?

Sorry to bang on about this, but with datasets being disconnected, the
flexible maniplualtion of this disconnected data becomes essential.

Show quoteHide quote
"Alex Passos" wrote:

> Look into DataSet.Merge, you can merge two datasets in that manner and
> append the columns for those that are not present as long as the sets share
> the same primary key.  Then plug it into DataGrid.
>
> Alex
>
> "TLWood" <volvo340@newsgroup.nospam> wrote in message
> news:84AF6226-2E5B-4D2D-BBF3-E30BAB03B0A0@microsoft.com...
> > Thanks Alex
> >
> > I have had a look into the datagrid, but it only seems to display one
> > table
> > at a time. In order to display fields from multiple tables on the same row
> > a
> > new query needs to be performed which combines the tables. This would be
> > OK
> > for a connected recordset, but for a disconnected dataset this cannot be
> > achieved since another trip to the database is not possible. I therefore
> > need
> > some way to get the data out of 2 tables in the dataset into the same row
> > in
> > the datagrid. Any ideas?
> >
> > "Alex Passos" wrote:
> >
> >> Hi Terry, look into using a DataGrid, it has exactly everything you need.
> >> Just attach the data set to the DataGrid.DataSource member and go from
> >> there.
> >>
> >> Alex
> >>
> >> "TLWood" <volvo340@newsgroup.nospam> wrote in message
> >> news:3643D60B-9D07-4068-ACA1-D8965BD5E464@microsoft.com...
> >> > Hi
> >> >
> >> > I am creating a multi-user db app in VB.NET 2003 which accesses a
> >> > remote
> >> > SQL
> >> > Server. The db has many tables related hierarchically. At the start of
> >> > a
> >> > session I want to get a selected set of data into a dataset, work with
> >> > it
> >> > extensively and put it back dealing with any conflicts at this time.
> >> >
> >> > My question is, how do I manupulate the data from the dataset to
> >> > display
> >> > it?
> >> > What I really want to do is create a multi-table view of some of the
> >> > data
> >> > in
> >> > the dataset and display it in a datagrid or similar. The normal
> >> > hierarchical
> >> > view of data in the datagrid is not user friendly enough - I need to
> >> > display
> >> > read-only rows of Customers each having several Addresses (related via
> >> > IDs
> >> > from a different table) each in a separate row allowing the user to
> >> > select
> >> > a
> >> > row (Customer/Address pair) and edit it elsewhere.
> >> >
> >> > Any help or pointers would be much appreciated.
> >> >
> >> > --
> >> > Many Thanks
> >> > Terry
> >>
> >>
> >>
>
>
>
Author
13 Apr 2005 6:19 PM
Alex Passos
I think you can create a disconnected set and merge into it only the tables
that you want.  So merge the first table, then merge the second table onto
the first, etc.  The parameters for merging are ample, you can do it with
sets, tables, and more.

http://msdn.microsoft.com  search DataGrid.Merge

Show quoteHide quote
"TLWood" <volvo340@newsgroup.nospam> wrote in message
news:C57C91A6-44B8-4DA1-873E-E49DAA947BAA@microsoft.com...
> Would this mean that I would have to put each table into a separate
> Dataset?
> This is a fairly comprehensive system with around 80 tables so the thought
> of
> manually setting up relationships (if this is possible) between all these
> separate datasets is pretty daunting. I was hoping that I was missing
> something obvious!
>
> It would be handy if there was a sort of multi-table View that can be done
> on a dataset. If I add a combined new table to the dataset with the
> required
> fields from multiple other tables, is there a sleek way of automatically
> updating it if the source tables are updated without resorting to the old
> fashioned manual approach?
>
> Sorry to bang on about this, but with datasets being disconnected, the
> flexible maniplualtion of this disconnected data becomes essential.
>
> "Alex Passos" wrote:
>
>> Look into DataSet.Merge, you can merge two datasets in that manner and
>> append the columns for those that are not present as long as the sets
>> share
>> the same primary key.  Then plug it into DataGrid.
>>
>> Alex
>>
>> "TLWood" <volvo340@newsgroup.nospam> wrote in message
>> news:84AF6226-2E5B-4D2D-BBF3-E30BAB03B0A0@microsoft.com...
>> > Thanks Alex
>> >
>> > I have had a look into the datagrid, but it only seems to display one
>> > table
>> > at a time. In order to display fields from multiple tables on the same
>> > row
>> > a
>> > new query needs to be performed which combines the tables. This would
>> > be
>> > OK
>> > for a connected recordset, but for a disconnected dataset this cannot
>> > be
>> > achieved since another trip to the database is not possible. I
>> > therefore
>> > need
>> > some way to get the data out of 2 tables in the dataset into the same
>> > row
>> > in
>> > the datagrid. Any ideas?
>> >
>> > "Alex Passos" wrote:
>> >
>> >> Hi Terry, look into using a DataGrid, it has exactly everything you
>> >> need.
>> >> Just attach the data set to the DataGrid.DataSource member and go from
>> >> there.
>> >>
>> >> Alex
>> >>
>> >> "TLWood" <volvo340@newsgroup.nospam> wrote in message
>> >> news:3643D60B-9D07-4068-ACA1-D8965BD5E464@microsoft.com...
>> >> > Hi
>> >> >
>> >> > I am creating a multi-user db app in VB.NET 2003 which accesses a
>> >> > remote
>> >> > SQL
>> >> > Server. The db has many tables related hierarchically. At the start
>> >> > of
>> >> > a
>> >> > session I want to get a selected set of data into a dataset, work
>> >> > with
>> >> > it
>> >> > extensively and put it back dealing with any conflicts at this time.
>> >> >
>> >> > My question is, how do I manupulate the data from the dataset to
>> >> > display
>> >> > it?
>> >> > What I really want to do is create a multi-table view of some of the
>> >> > data
>> >> > in
>> >> > the dataset and display it in a datagrid or similar. The normal
>> >> > hierarchical
>> >> > view of data in the datagrid is not user friendly enough - I need to
>> >> > display
>> >> > read-only rows of Customers each having several Addresses (related
>> >> > via
>> >> > IDs
>> >> > from a different table) each in a separate row allowing the user to
>> >> > select
>> >> > a
>> >> > row (Customer/Address pair) and edit it elsewhere.
>> >> >
>> >> > Any help or pointers would be much appreciated.
>> >> >
>> >> > --
>> >> > Many Thanks
>> >> > Terry
>> >>
>> >>
>> >>
>>
>>
>>
Author
13 Apr 2005 8:06 PM
TLWood
Thanks Alex

What I was hoping for was to replicate a subset of the database within an
identically structured strongly typed dataset so that the structure of the
system was simple and logical to follow. I was expecting the datagrid to be
more flexible than it is, and the dataset functionality to be more flexible
as well. It seems neither are, and are instead keyed up well for flat data.

I can get around this problem by creating new tables in the dataset which
merge the data from several other tables each time the source table data
changes by adding handlers to the rowchanged events of the source tables, but
I think that this is very messy and a slicker approach should be possible. If
only the datagrid could look at more than one table per row! The hierarchical
display it offers is not user friendly at all for end users, who need well
formatted data clearly visible all the time without the need to drop-down to
hidden related data.

Anyway, thanks for all your help, much appreciated.

Show quoteHide quote
"Alex Passos" wrote:

> I think you can create a disconnected set and merge into it only the tables
> that you want.  So merge the first table, then merge the second table onto
> the first, etc.  The parameters for merging are ample, you can do it with
> sets, tables, and more.
>
> http://msdn.microsoft.com  search DataGrid.Merge
>
> "TLWood" <volvo340@newsgroup.nospam> wrote in message
> news:C57C91A6-44B8-4DA1-873E-E49DAA947BAA@microsoft.com...
> > Would this mean that I would have to put each table into a separate
> > Dataset?
> > This is a fairly comprehensive system with around 80 tables so the thought
> > of
> > manually setting up relationships (if this is possible) between all these
> > separate datasets is pretty daunting. I was hoping that I was missing
> > something obvious!
> >
> > It would be handy if there was a sort of multi-table View that can be done
> > on a dataset. If I add a combined new table to the dataset with the
> > required
> > fields from multiple other tables, is there a sleek way of automatically
> > updating it if the source tables are updated without resorting to the old
> > fashioned manual approach?
> >
> > Sorry to bang on about this, but with datasets being disconnected, the
> > flexible maniplualtion of this disconnected data becomes essential.
> >
> > "Alex Passos" wrote:
> >
> >> Look into DataSet.Merge, you can merge two datasets in that manner and
> >> append the columns for those that are not present as long as the sets
> >> share
> >> the same primary key.  Then plug it into DataGrid.
> >>
> >> Alex
> >>
> >> "TLWood" <volvo340@newsgroup.nospam> wrote in message
> >> news:84AF6226-2E5B-4D2D-BBF3-E30BAB03B0A0@microsoft.com...
> >> > Thanks Alex
> >> >
> >> > I have had a look into the datagrid, but it only seems to display one
> >> > table
> >> > at a time. In order to display fields from multiple tables on the same
> >> > row
> >> > a
> >> > new query needs to be performed which combines the tables. This would
> >> > be
> >> > OK
> >> > for a connected recordset, but for a disconnected dataset this cannot
> >> > be
> >> > achieved since another trip to the database is not possible. I
> >> > therefore
> >> > need
> >> > some way to get the data out of 2 tables in the dataset into the same
> >> > row
> >> > in
> >> > the datagrid. Any ideas?
> >> >
> >> > "Alex Passos" wrote:
> >> >
> >> >> Hi Terry, look into using a DataGrid, it has exactly everything you
> >> >> need.
> >> >> Just attach the data set to the DataGrid.DataSource member and go from
> >> >> there.
> >> >>
> >> >> Alex
> >> >>
> >> >> "TLWood" <volvo340@newsgroup.nospam> wrote in message
> >> >> news:3643D60B-9D07-4068-ACA1-D8965BD5E464@microsoft.com...
> >> >> > Hi
> >> >> >
> >> >> > I am creating a multi-user db app in VB.NET 2003 which accesses a
> >> >> > remote
> >> >> > SQL
> >> >> > Server. The db has many tables related hierarchically. At the start
> >> >> > of
> >> >> > a
> >> >> > session I want to get a selected set of data into a dataset, work
> >> >> > with
> >> >> > it
> >> >> > extensively and put it back dealing with any conflicts at this time.
> >> >> >
> >> >> > My question is, how do I manupulate the data from the dataset to
> >> >> > display
> >> >> > it?
> >> >> > What I really want to do is create a multi-table view of some of the
> >> >> > data
> >> >> > in
> >> >> > the dataset and display it in a datagrid or similar. The normal
> >> >> > hierarchical
> >> >> > view of data in the datagrid is not user friendly enough - I need to
> >> >> > display
> >> >> > read-only rows of Customers each having several Addresses (related
> >> >> > via
> >> >> > IDs
> >> >> > from a different table) each in a separate row allowing the user to
> >> >> > select
> >> >> > a
> >> >> > row (Customer/Address pair) and edit it elsewhere.
> >> >> >
> >> >> > Any help or pointers would be much appreciated.
> >> >> >
> >> >> > --
> >> >> > Many Thanks
> >> >> > Terry
> >> >>
> >> >>
> >> >>
> >>
> >>
> >>
>
>
>
Author
14 Apr 2005 2:40 AM
Kevin Yu [MSFT]
Hi Terry,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you have two tables and need to display
them on a DataGrid. If there is any misunderstanding, please feel free to
let me know.

In this case we can use two DataGrids to display the master and detailed
tables. We have to fill the customer and address table into the same
DataSet and create a DataRelation between the tables. Then we can bind the
two DataGrids to the table and the relation. When the master record
changes, the detailed records displayed on another DataGrid will change
according to it. You can check the following article for more information
on this.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/
vbtskcreatingmasterdetailslistwithdatagrid.asp

HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
Author
14 Apr 2005 8:18 AM
TLWood
Hi Kevin

Thanks for your reply.

I can do as you say fine with 2 datagrids. Trouble with this approach is
that Addresses for non-selected Customers are hidden. I need all the
addresses for all custtomers displayed all of the time as read only. When the
user selects a row then a dialog will display with bound textboxes etc. in
order to edit the customer details and addresses.

All it needs really is to be able to create a multi-table view of of the
data in the dataset so that a datagrid can bind to that and thus be updated
automatically if either of the underlying tables change. Alternatively, it
would be nice if the datagrid's tablestyles property could map to multiple
tables allowing the necessary fields to be mapped in the columnstyles.

My example is a many-to-many relationship - I have Customer, Address and
CustomerToAddress tables to acheive this. The only way I have found to
achieve my desired functionality so far is to create a dummy table of my
required fields in the dataset and keep repopulating it each time either of
the source tables changes which seems a little clumsy to me.

Maybe this functionality requires some coding of this or similar sort.

Show quoteHide quote
"Kevin Yu [MSFT]" wrote:

> Hi Terry,
>
> First of all, I would like to confirm my understanding of your issue. From
> your description, I understand that you have two tables and need to display
> them on a DataGrid. If there is any misunderstanding, please feel free to
> let me know.
>
> In this case we can use two DataGrids to display the master and detailed
> tables. We have to fill the customer and address table into the same
> DataSet and create a DataRelation between the tables. Then we can bind the
> two DataGrids to the table and the relation. When the master record
> changes, the detailed records displayed on another DataGrid will change
> according to it. You can check the following article for more information
> on this.
>
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/
> vbtskcreatingmasterdetailslistwithdatagrid.asp
>
> HTH.
>
> Kevin Yu
> =======
> "This posting is provided "AS IS" with no warranties, and confers no
> rights."
>
>
Author
14 Apr 2005 10:29 AM
Cor Ligthert
Terry,

Is this sample, roughly made however working what you are looking for?

\\\Needs a form with two datagrids
Private Sub Form1_Load(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles MyBase.Load
        Dim ds As New DataSet
        Dim dt As New DataTable
        ds.Tables.Add(dt)
        dt.Columns.Add("Name")
        dt.Columns.Add("Place")
        dt.LoadDataRow(New Object() {"Kevin", "Somewhere"}, True)
        dt.LoadDataRow(New Object() {"Terry", "Somewhere"}, True)
        dt.LoadDataRow(New Object() {"Cor", "Holland"}, True)
        DataGrid1.DataSource = dt.DefaultView
        dt.DefaultView.AllowDelete = False
        dt.DefaultView.AllowEdit = False
        dt.DefaultView.AllowNew = False
        Dim cma As CurrencyManager = DirectCast _
        (BindingContext(dt.DefaultView), CurrencyManager)
        AddHandler cma.CurrentChanged, AddressOf rowchanging
        rowchanging(Me, Nothing)
    End Sub

    Public Sub rowchanging(ByVal sender As Object, _
    ByVal e As EventArgs)
        Dim dv1 As DataView = DirectCast(DataGrid1.DataSource, DataView)
        Dim dv2 As New DataView(DirectCast(DataGrid1.DataSource,
DataView).Table)
        Dim cma As CurrencyManager =  _
        DirectCast(BindingContext(dv1),  CurrencyManager)
        dv2.RowFilter = "Name = '" & dv1(cma.Position)("Name").ToString &
"'"
        DataGrid2.DataSource = dv2
    End Sub
///

I hope this helps a little bit?

Cor
Author
14 Apr 2005 12:03 PM
TLWood
Many thanks for the code Cor

My situation is really manipulating the data from the multiple tables into
my required format, I have:

Customer Table:
CustomerID
Title
FirstName
LastName
Mobile
etc.

Address Table:
AddressID
Address
Owner
Telephone
etc.

CustomerToAddress Table:
CustomerID
AddressID

A customer can have many addresses, similarly several customers could share
an address. These tables above are represented in the dataset in the same
structure as in the database.

I simply want to display a list of the Customers and their corresponding
addresses, so that a customer/address pair can be clicked and either the
customer data, address data or both can be editied in a separate form. Also
customers, addresses can be added and deleted in the disconnected dataset. It
is important that fields from both the customers and address tables are all
visible all of the time and updated automatically when any of the underlying
data is changed. It seems as though there is no in-built mechanism to do this.


Show quoteHide quote
"Cor Ligthert" wrote:

> Terry,
>
> Is this sample, roughly made however working what you are looking for?
>
> \\\Needs a form with two datagrids
> Private Sub Form1_Load(ByVal sender As System.Object, _
>     ByVal e As System.EventArgs) Handles MyBase.Load
>         Dim ds As New DataSet
>         Dim dt As New DataTable
>         ds.Tables.Add(dt)
>         dt.Columns.Add("Name")
>         dt.Columns.Add("Place")
>         dt.LoadDataRow(New Object() {"Kevin", "Somewhere"}, True)
>         dt.LoadDataRow(New Object() {"Terry", "Somewhere"}, True)
>         dt.LoadDataRow(New Object() {"Cor", "Holland"}, True)
>         DataGrid1.DataSource = dt.DefaultView
>         dt.DefaultView.AllowDelete = False
>         dt.DefaultView.AllowEdit = False
>         dt.DefaultView.AllowNew = False
>         Dim cma As CurrencyManager = DirectCast _
>         (BindingContext(dt.DefaultView), CurrencyManager)
>         AddHandler cma.CurrentChanged, AddressOf rowchanging
>         rowchanging(Me, Nothing)
>     End Sub
>
>     Public Sub rowchanging(ByVal sender As Object, _
>     ByVal e As EventArgs)
>         Dim dv1 As DataView = DirectCast(DataGrid1.DataSource, DataView)
>         Dim dv2 As New DataView(DirectCast(DataGrid1.DataSource,
> DataView).Table)
>         Dim cma As CurrencyManager =  _
>         DirectCast(BindingContext(dv1),  CurrencyManager)
>         dv2.RowFilter = "Name = '" & dv1(cma.Position)("Name").ToString &
> "'"
>         DataGrid2.DataSource = dv2
>     End Sub
> ///
>
> I hope this helps a little bit?
>
> Cor
>
>
>
Author
14 Apr 2005 12:11 PM
Cor Ligthert
Terry,

Try my sample, I took the name, however you will probably need to use the
id's and than you can in my opinion even create one master grid with sub
grids below it.

Cor
Author
14 Apr 2005 1:03 PM
TLWood
Hi Cor

Yes I have tried your sample, but unfortunately it starts assuming the
problem has been solved. That is, in order to produce the first datagrid of
data, I have 3 tables to extract the data from, whereas your sample just has
1 table. This is the issue that needs resolving, not editing the data
afterwards.

The prblem is, given the 3 related tables in my earlier post, how does one
single datagrid display the following:

row1 - name1, address1
row2 - name1, address2
row3 - name1, address3
row4 - name2, address4
row5 - name2, address5
row6 - name3, address6
etc.

Show quoteHide quote
"Cor Ligthert" wrote:

> Terry,
>
> Try my sample, I took the name, however you will probably need to use the
> id's and than you can in my opinion even create one master grid with sub
> grids below it.
>
> Cor
>
>
>
Author
14 Apr 2005 3:30 PM
Cor Ligthert
Terry,

You mean something what is basicly simple this.


\\\
        Dim ds As New DataSet
        Dim dt1 As New DataTable("names")
        Dim dt2 As New DataTable("addresses1")
        Dim dt3 As New DataTable("addresses2")
        ds.Tables.Add(dt1)
        ds.Tables.Add(dt2)
        ds.Tables.Add(dt3)
        dt1.Columns.Add("AddressId")
        dt1.Columns.Add("Name")
        dt1.LoadDataRow(New Object() {"1", "Kevin"}, True)
        dt1.LoadDataRow(New Object() {"2", "Terry"}, True)
        dt1.LoadDataRow(New Object() {"3", "Cor"}, True)
        dt2.Columns.Add("AddressId")
        dt2.Columns.Add("Adress")
        dt2.LoadDataRow(New Object() {"1", "Somewhere"}, True)
        dt2.LoadDataRow(New Object() {"2", "Somewhere"}, True)
        dt2.LoadDataRow(New Object() {"3", "Holland"}, True)
        dt3.Columns.Add("AddressId")
        dt3.Columns.Add("Adress2")
        dt3.LoadDataRow(New Object() {"1", "Dont Know"}, True)
        dt3.LoadDataRow(New Object() {"2", "Who"}, True)
        dt3.LoadDataRow(New Object() {"3", "EU"}, True)
        Dim drel1 As New DataRelation _
            ("Adresses1", ds.Tables("names").Columns("addressId"), _
         ds.Tables("addresses1").Columns("addressId"))
        Dim drel2 As New DataRelation _
             ("Adresses2", ds.Tables("names").Columns("addressId"), _
                 ds.Tables("addresses2").Columns("addressId"))
        ds.Relations.Add(drel1)
        ds.Relations.Add(drel2)
        DataGrid1.DataSource = ds.Tables("names")
        DataGrid1.Expand(-1)
///


Cor
Author
14 Apr 2005 4:26 PM
TLWood
Unfortunately, no.

This code gives the standard datagrid drop down hierarchy, whereby you need
to click to get the addresses, then click back to get back to the customers.
This is in no way adequate for a user friendly interface.

I need it all visible at once. I think this can only be done by creating a
dummy table on the fly, so I guess I will do it that way.

Thanks for all your work though.

Show quoteHide quote
"Cor Ligthert" wrote:

> Terry,
>
> You mean something what is basicly simple this.
>
>
> \\\
>         Dim ds As New DataSet
>         Dim dt1 As New DataTable("names")
>         Dim dt2 As New DataTable("addresses1")
>         Dim dt3 As New DataTable("addresses2")
>         ds.Tables.Add(dt1)
>         ds.Tables.Add(dt2)
>         ds.Tables.Add(dt3)
>         dt1.Columns.Add("AddressId")
>         dt1.Columns.Add("Name")
>         dt1.LoadDataRow(New Object() {"1", "Kevin"}, True)
>         dt1.LoadDataRow(New Object() {"2", "Terry"}, True)
>         dt1.LoadDataRow(New Object() {"3", "Cor"}, True)
>         dt2.Columns.Add("AddressId")
>         dt2.Columns.Add("Adress")
>         dt2.LoadDataRow(New Object() {"1", "Somewhere"}, True)
>         dt2.LoadDataRow(New Object() {"2", "Somewhere"}, True)
>         dt2.LoadDataRow(New Object() {"3", "Holland"}, True)
>         dt3.Columns.Add("AddressId")
>         dt3.Columns.Add("Adress2")
>         dt3.LoadDataRow(New Object() {"1", "Dont Know"}, True)
>         dt3.LoadDataRow(New Object() {"2", "Who"}, True)
>         dt3.LoadDataRow(New Object() {"3", "EU"}, True)
>         Dim drel1 As New DataRelation _
>             ("Adresses1", ds.Tables("names").Columns("addressId"), _
>          ds.Tables("addresses1").Columns("addressId"))
>         Dim drel2 As New DataRelation _
>              ("Adresses2", ds.Tables("names").Columns("addressId"), _
>                  ds.Tables("addresses2").Columns("addressId"))
>         ds.Relations.Add(drel1)
>         ds.Relations.Add(drel2)
>         DataGrid1.DataSource = ds.Tables("names")
>         DataGrid1.Expand(-1)
> ///
>
>
> Cor
>
>
>
Author
15 Apr 2005 7:32 AM
Kevin Yu [MSFT]
Hi Terry,

Based on the discussion on this thread, I think you need to display all the
customer and address information at first glance. After the user clicks to
select a customer and an address, he can edit the information in Textboxes.
Am I right?

In this case, we can use two DataGrids to bind to the Customer table and
Address table. When the row in the grids are selected, we use some
TextBoxes to display each fields. To get the selected row from DataGrid,
use CurrencyManager as Cor suggested. Since DataGrid and TextBoxes bind to
the same data source, when you have changed data in textbox, the data in
the DataGrid will also change.

If anything is unclear, please feel free to reply to this post.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
Author
14 Apr 2005 7:50 AM
Cor Ligthert
TLWoods,

When the datagrid does not fit your needs, than I would go for binded
textboxes.

You need for that the textboxes, 5 or 7 buttons. << < New Update Delete > >>

Binding from the textboxes and the currencymanager.

I think that for that the sample on this page is a good start
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemWindowsFormsCurrencyManagerClassTopic.asp

I hope this helps,

Cor
Author
14 Apr 2005 8:27 AM
TLWood
Thanks Cor

I am using the datagrid (or trying to!) in order to display all of the
customers and their associated multiple addresses concisely, allowing end
users who are working in a high-pressure telesales environment rapid
examination of all information without the need for any keystrokes and
without hidden data. If editing of the data is required, they can then select
a customer/address pair (i.e. datagrid row) and click a Modify button, which
will then, as you say, present a series of bound textboxes etc. for editing.

This system will be using around 80 hierarchical tables, this example
(customers/addresses) is the simplest, so if I can't get a slick solution
using the standard controls and functions for this, then I stand no chance! I
guess it will be back to the usual log way around!


Show quoteHide quote
"Cor Ligthert" wrote:

> TLWoods,
>
> When the datagrid does not fit your needs, than I would go for binded
> textboxes.
>
> You need for that the textboxes, 5 or 7 buttons. << < New Update Delete > >>
>
> Binding from the textboxes and the currencymanager.
>
> I think that for that the sample on this page is a good start
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemWindowsFormsCurrencyManagerClassTopic.asp
>
> I hope this helps,
>
> Cor
>
>
>
Author
14 Apr 2005 8:42 AM
Cor Ligthert
TL,

When I understand you well, is than instead of that datagrid one or more
comboboxes/listboxes not much more properiate?

You even can start with an inherited form for your basic approach.

Cor
Author
14 Apr 2005 8:46 AM
Cor Ligthert
TL,

In addition to my previous message, when you use this than in my opinion can
you even create a kind of general solution.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemDataSqlServerCeSqlCeDataReaderClassGetSchemaTableTopic.asp

I hope this helps,

Cor
Author
14 Apr 2005 9:13 AM
TLWood
Hi Cor

I actually need to display several columns of customer and address data in
the same rows. I liked the datagrid approach in essense because it provided a
flexible columnated display. The listbox and comboboxes don't handle
multicolumns, but the issue really is about the manupulation of the
underlying data. There does not seem a built in way to view multi-table data
from the source tables in the dataset.

Show quoteHide quote
"Cor Ligthert" wrote:

> TL,
>
> In addition to my previous message, when you use this than in my opinion can
> you even create a kind of general solution.
>
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemDataSqlServerCeSqlCeDataReaderClassGetSchemaTableTopic.asp
>
> I hope this helps,
>
> Cor
>
>
>

Bookmark and Share