Home All Groups Group Topic Archive Search About

DataViews with DataSets

Author
11 May 2006 7:48 PM
Bernie Hunt
I currently have a datagrid that I'm feeding with a DataSet, which contains
three tables. I would like to use a DataView to format the DataTables but
I'm not sure how to go about this.

Currently I have;

dsVendorContacts is a DataSet with three tables and relational links
dgVendors is a DataGrid

        With dgVendors
             .DataSource = dsVendorContacts
           .DataMember = "wwVendors"
     End With

If I create three DataViews, how do I attach the three seperate DataViews
to the grid and specify the main DataView?

Can I put DataViews into a DataSet?

Thanks,

Bernie

Author
11 May 2006 8:28 PM
Cor Ligthert [MVP]
Bernie,

Every datatable has one dataview.
The name of that is the defaultview.

The dataview is nothing more than a class that holds things as a rowfilter,
a sort property and a collection of references to the dataviewrows (which
all have again a reference to a datarow).

Therefore you cannot handle it as a real table.

I hope this helps,

Cor

Show quoteHide quote
"Bernie Hunt" <bh***@optonline.net> schreef in bericht
news:Xns97C0A0DBAC551bhuntoptonlinenet@207.46.248.16...
>I currently have a datagrid that I'm feeding with a DataSet, which contains
> three tables. I would like to use a DataView to format the DataTables but
> I'm not sure how to go about this.
>
> Currently I have;
>
> dsVendorContacts is a DataSet with three tables and relational links
> dgVendors is a DataGrid
>
>    With dgVendors
>         .DataSource = dsVendorContacts
>           .DataMember = "wwVendors"
>     End With
>
> If I create three DataViews, how do I attach the three seperate DataViews
> to the grid and specify the main DataView?
>
> Can I put DataViews into a DataSet?
>
> Thanks,
>
> Bernie
Author
12 May 2006 10:43 AM
Bernie Hunt
Hi Cor!

So then, using my previous example, would I?

dsVendorContacts is a DataSet with three tables and relational links
dgVendors is a DataGrid

With dsVendorContacts.Tables("wwVendors").DefaultView
        .Sort = "LastName ASC"
        .AllowNew = False
End With

With dgVendors
        .DataSource = dsVendorContacts
        .DataMember = "wwVendors"
End With

And the sort and disallow would be in the grid when shown?

Sorry I'm away from my development station so I can't try out. It's
working on paper this morning.

Bernie


Show quoteHide quote
"Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in
news:uMw54kTdGHA.3344@TK2MSFTNGP05.phx.gbl:

> Bernie,
>
> Every datatable has one dataview.
> The name of that is the defaultview.
>
> The dataview is nothing more than a class that holds things as a
> rowfilter, a sort property and a collection of references to the
> dataviewrows (which all have again a reference to a datarow).
>
> Therefore you cannot handle it as a real table.
>
> I hope this helps,
>
> Cor
>
> "Bernie Hunt" <bh***@optonline.net> schreef in bericht
> news:Xns97C0A0DBAC551bhuntoptonlinenet@207.46.248.16...
>>I currently have a datagrid that I'm feeding with a DataSet, which
>>contains
>> three tables. I would like to use a DataView to format the DataTables
>> but I'm not sure how to go about this.
>>
>> Currently I have;
>>
>> dsVendorContacts is a DataSet with three tables and relational links
>> dgVendors is a DataGrid
>>
>>    With dgVendors
>>         .DataSource = dsVendorContacts
>>           .DataMember = "wwVendors"
>>     End With
>>
>> If I create three DataViews, how do I attach the three seperate
>> DataViews to the grid and specify the main DataView?
>>
>> Can I put DataViews into a DataSet?
>>
>> Thanks,
>>
>> Bernie
>
>
>
Author
12 May 2006 11:53 AM
Cor Ligthert [MVP]
Bernie,

If I don't oversee something, yes.

Cor

Show quoteHide quote
"Bernie Hunt" <bh***@optonline.net> schreef in bericht
news:Xns97C144610CE45bhuntoptonlinenet@207.46.248.16...
> Hi Cor!
>
> So then, using my previous example, would I?
>
> dsVendorContacts is a DataSet with three tables and relational links
> dgVendors is a DataGrid
>
> With dsVendorContacts.Tables("wwVendors").DefaultView
>    .Sort = "LastName ASC"
>    .AllowNew = False
> End With
>
> With dgVendors
>    .DataSource = dsVendorContacts
>    .DataMember = "wwVendors"
> End With
>
> And the sort and disallow would be in the grid when shown?
>
> Sorry I'm away from my development station so I can't try out. It's
> working on paper this morning.
>
> Bernie
>
>
> "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in
> news:uMw54kTdGHA.3344@TK2MSFTNGP05.phx.gbl:
>
>> Bernie,
>>
>> Every datatable has one dataview.
>> The name of that is the defaultview.
>>
>> The dataview is nothing more than a class that holds things as a
>> rowfilter, a sort property and a collection of references to the
>> dataviewrows (which all have again a reference to a datarow).
>>
>> Therefore you cannot handle it as a real table.
>>
>> I hope this helps,
>>
>> Cor
>>
>> "Bernie Hunt" <bh***@optonline.net> schreef in bericht
>> news:Xns97C0A0DBAC551bhuntoptonlinenet@207.46.248.16...
>>>I currently have a datagrid that I'm feeding with a DataSet, which
>>>contains
>>> three tables. I would like to use a DataView to format the DataTables
>>> but I'm not sure how to go about this.
>>>
>>> Currently I have;
>>>
>>> dsVendorContacts is a DataSet with three tables and relational links
>>> dgVendors is a DataGrid
>>>
>>>    With dgVendors
>>>         .DataSource = dsVendorContacts
>>>           .DataMember = "wwVendors"
>>>     End With
>>>
>>> If I create three DataViews, how do I attach the three seperate
>>> DataViews to the grid and specify the main DataView?
>>>
>>> Can I put DataViews into a DataSet?
>>>
>>> Thanks,
>>>
>>> Bernie
>>
>>
>>
>
Author
12 May 2006 11:56 AM
Cor Ligthert [MVP]
Bernie,

I once had a problem with that, so I use forever.

dgVendors.DataSource = dsVendorContacts.Tables("wwVendors").DefaultView

There is than no need to set the member.

cor