Home All Groups Group Topic Archive Search About
Author
2 Feb 2007 8:30 PM
Charles A. Lackman
Hello I have a DataView using the DataViewManager that was created from a
Dataset with a Relationship.

The Parent View is "Customers"
The Child View is "Contacts"

I am looking for a way to Sort the ContactsView and perform a Find on it.

I.E.

CustomerView.DataViewSettings("Customers.Contacts").Table.DefaultView.Sort =
"ID"

RowPosition =
CustomerView.DataViewSettings("Customers.Contacts").Table.DefaultView.Find("12")


This does not work, any suggestions will be greatly appreciated.

Thanks,

Chuck

Author
3 Feb 2007 12:24 PM
Bart Mermuys
Hi,

Show quote
"Charles A. Lackman" <Char***@CreateItSoftware.net> wrote in message
news:uH%23XBkwRHHA.4832@TK2MSFTNGP04.phx.gbl...
> Hello I have a DataView using the DataViewManager that was created from a
> Dataset with a Relationship.
>
> The Parent View is "Customers"
> The Child View is "Contacts"
>
> I am looking for a way to Sort the ContactsView and perform a Find on it.
>
> I.E.
>
> CustomerView.DataViewSettings("Customers.Contacts").Table.DefaultView.Sort
> =
> "ID"
>
> RowPosition =
> CustomerView.DataViewSettings("Customers.Contacts").Table.DefaultView.Find("12")
>
>
> This does not work, any suggestions will be greatly appreciated.
>

I'm not entirely sure what you are saying/asking... You are only talking
about DataView's but did you bind in a parent-child way using the
DataViewManager, if you did, can you post some of the binding code or tell
how you setup the binding ?

Are you using NET1.1 or NET2.0 ?

HTH,
Greetings

Show quote
> Thanks,
>
> Chuck
>
>
Author
5 Feb 2007 1:11 AM
Charles A. Lackman
Hello,

I hope this helps.

Customers Table (This works): (CustomerDataset)
ID - Integer
Name - VarChar
Address - VarChar

Contacts Table (This works): (CustomerDataset)
ID - Integer
ContactName- VarChar
ContactPhone- VarChar

The Relationship (This works):
CustomerDataset.Relations.Add("Children",
CustomerDataset.Tables("Customers").Columns("ID"),
CustomerDataset.Tables("Contacts").Columns("ID"), False)

The DataViewManager (This works):
TheCustomerView = New DataViewManager(CustomerDataset)

Find a Row in the Child Table??? (This does NOT work):
Dim RowPosition as Integer
CustomerView.DataViewSettings("Customers.Children").Table.DefaultView.Sort =
"ID"
RowPosition  =
CustomerView.DataViewSettings("Customers.Children").Table.DefaultView.Find("12")

Move to the Row (This works):
BindingContext(CustomerView.DataViewSettings("Customers").Table,
"Children").Position = RowPosition


I do a sort on the Customers Table and it returns some rows, in the returned
rows I want to do a search also to display the correct row of data.

Thanks,

Chuck
Author
5 Feb 2007 3:07 AM
RobinS
Are you using .Net 1.1 or .Net 2.0?

Robin S.
Ts'i mahnu uterna ot twan ot geifur hingts uto.
-----------------------------------------------
Show quote
"Charles A. Lackman" <Char***@CreateItSoftware.net> wrote in message
news:ewNvRKMSHHA.2124@TK2MSFTNGP06.phx.gbl...
> Hello,
>
> I hope this helps.
>
> Customers Table (This works): (CustomerDataset)
> ID - Integer
> Name - VarChar
> Address - VarChar
>
> Contacts Table (This works): (CustomerDataset)
> ID - Integer
> ContactName- VarChar
> ContactPhone- VarChar
>
> The Relationship (This works):
> CustomerDataset.Relations.Add("Children",
> CustomerDataset.Tables("Customers").Columns("ID"),
> CustomerDataset.Tables("Contacts").Columns("ID"), False)
>
> The DataViewManager (This works):
> TheCustomerView = New DataViewManager(CustomerDataset)
>
> Find a Row in the Child Table??? (This does NOT work):
> Dim RowPosition as Integer
> CustomerView.DataViewSettings("Customers.Children").Table.DefaultView.Sort
> =
> "ID"
> RowPosition  =
> CustomerView.DataViewSettings("Customers.Children").Table.DefaultView.Find("12")
>
> Move to the Row (This works):
> BindingContext(CustomerView.DataViewSettings("Customers").Table,
> "Children").Position = RowPosition
>
>
> I do a sort on the Customers Table and it returns some rows, in the
> returned
> rows I want to do a search also to display the correct row of data.
>
> Thanks,
>
> Chuck
>
>
Author
5 Feb 2007 5:53 AM
Bart Mermuys
Hi,

Show quote
"Charles A. Lackman" <Char***@CreateItSoftware.net> wrote in message
news:ewNvRKMSHHA.2124@TK2MSFTNGP06.phx.gbl...
> Hello,
>
> I hope this helps.
>
> Customers Table (This works): (CustomerDataset)
> ID - Integer
> Name - VarChar
> Address - VarChar
>
> Contacts Table (This works): (CustomerDataset)
> ID - Integer
> ContactName- VarChar
> ContactPhone- VarChar
>
> The Relationship (This works):
> CustomerDataset.Relations.Add("Children",
> CustomerDataset.Tables("Customers").Columns("ID"),
> CustomerDataset.Tables("Contacts").Columns("ID"), False)
>
> The DataViewManager (This works):
> TheCustomerView = New DataViewManager(CustomerDataset)

Ok so far...

>
> Find a Row in the Child Table??? (This does NOT work):

I guess you mean child view ?  Because if you want to find a row inside the
child table, then you could simply use the child table.

> Dim RowPosition as Integer
> CustomerView.DataViewSettings("Customers.Children").Table.DefaultView.Sort
> =
> "ID"
> RowPosition  =
> CustomerView.DataViewSettings("Customers.Children").Table.DefaultView.Find("12")
>

> Move to the Row (This works):
> BindingContext(CustomerView.DataViewSettings("Customers").Table,
> "Children").Position = RowPosition

You're using the Table property, so that's the exact same as:

BindingContext( CustomersDataSet.Tables("Customers"), "Children" ).Position
= RowPosition

Anyways, you still haven't shown how you setup the bindings, so i can only
guess, but it looks like you have bound the child Control(s) to the
Customers table and Childeren relation, you're not even binding to the
DataViewManager and you probely don't need to.  Maybe this is what you are
looking for:

Dim childCM As CurrencyManager
Dim childDV As DataView

' when getting the CurrencyManager from the BindingContext, you
' need to use the same DataSource(ref) and DataMember (excluding
' fieldname; can be empty) as you used to setup the DataBinding
childCM = DirectCast( BindingContext(CustomersDataSet.Tables("Customers"),
"Children"), CurrencyManager )
childDV = DirectCast( childCM.List, DataView )

childDV.Sort = "ID"
childCM.Position = childDV.Find("12")

HTH,
Greetings

Show quote
>
> I do a sort on the Customers Table and it returns some rows, in the
> returned
> rows I want to do a search also to display the correct row of data.
>
> Thanks,
>
> Chuck
>
>
Author
5 Feb 2007 5:03 AM
Cor Ligthert [MVP]
Charles,

Don't knit while finding a solution.

As far as I can see is the only thing you needs.

TheTable.("Contacts").DefaultView.Sort = "ID"
TheTable.("Contacts").DevaultView.Find("12")

In my idea does your relation not add much in this.

Cor


Show quote
"Charles A. Lackman" <Char***@CreateItSoftware.net> schreef in bericht
news:uH%23XBkwRHHA.4832@TK2MSFTNGP04.phx.gbl...
> Hello I have a DataView using the DataViewManager that was created from a
> Dataset with a Relationship.
>
> The Parent View is "Customers"
> The Child View is "Contacts"
>
> I am looking for a way to Sort the ContactsView and perform a Find on it.
>
> I.E.
>
> CustomerView.DataViewSettings("Customers.Contacts").Table.DefaultView.Sort
> =
> "ID"
>
> RowPosition =
> CustomerView.DataViewSettings("Customers.Contacts").Table.DefaultView.Find("12")
>
>
> This does not work, any suggestions will be greatly appreciated.
>
> Thanks,
>
> Chuck
>
>
Author
5 Feb 2007 9:02 AM
Charles A. Lackman
Hello and Thanks for you help.

Everything is working fine now.

Chuck

"Charles A. Lackman" <Char***@CreateItSoftware.net> wrote in message
news:uH%23XBkwRHHA.4832@TK2MSFTNGP04.phx.gbl...
Hello I have a DataView using the DataViewManager that was created from a
Dataset with a Relationship.

The Parent View is "Customers"
The Child View is "Contacts"

I am looking for a way to Sort the ContactsView and perform a Find on it.

I.E.

CustomerView.DataViewSettings("Customers.Contacts").Table.DefaultView.Sort =
"ID"

RowPosition =
CustomerView.DataViewSettings("Customers.Contacts").Table.DefaultView.Find("12")


This does not work, any suggestions will be greatly appreciated.

Thanks,

Chuck

AddThis Social Bookmark Button