|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
DataView on two DataTablesHi,
Please, help. Can I create a DataView on top of more than one DataTable. If not, how can I implement this for sorting, filtering????? -- Regards, Garik Melkonyan MCP, MCAD, MCSD .NET Garik wrote:
> Hi, A dataview is a view on a single table. It contains the rows from the> > Please, help. Can I create a DataView on top of more than one > DataTable. If not, how can I implement this for sorting, > filtering????? underlying datatable matching the filter you set sorted using the sorter you set. FB -- ------------------------------------------------------------------------ Lead developer of LLBLGen Pro, the productive O/R mapper for .NET LLBLGen Pro website: http://www.llblgen.com My .NET blog: http://weblogs.asp.net/fbouma Microsoft MVP (C#) ------------------------------------------------------------------------ > If not, how can I implement this for sorting, filtering????? That is completely dependend from what you want, however as Frans said, a > dataview is only doing one table, therefore tell what you want, and what is the data in your rows (and what are the relations) Cor For example I have two tables: Order Header and Customer, and a relation
OrderHeader.CustKey = Customer.CustKey. So, I want to show Orders in the DataGridView, and Filter or Sort that grid by 'Customer.CustomerName, Order.OrderDate DESC'. Thanks. Show quote "Cor Ligthert [MVP]" wrote: > > > If not, how can I implement this for sorting, filtering????? > > > That is completely dependend from what you want, however as Frans said, a > dataview is only doing one table, therefore tell what you want, and what is > the data in your rows (and what are the relations) > > Cor > > > Garik,
Not giving the fish I would say, that in your case I would probably do something as filtering either using the Select or the DataView the Parent table on the CustKeys I want and than use that to get the children. (That is an existing method from datarow). Then you have the collection of datarows that you want to show. Cor Show quote "Garik" <garik_ma@do not spam.yahoo.com> schreef in bericht news:4F794C82-B126-49C2-98EC-D07E64F9F742@microsoft.com... > For example I have two tables: Order Header and Customer, and a relation > OrderHeader.CustKey = Customer.CustKey. > > So, I want to show Orders in the DataGridView, and Filter or Sort that > grid > by 'Customer.CustomerName, Order.OrderDate DESC'. > > Thanks. > > "Cor Ligthert [MVP]" wrote: > >> >> > If not, how can I implement this for sorting, filtering????? >> > >> That is completely dependend from what you want, however as Frans said, a >> dataview is only doing one table, therefore tell what you want, and what >> is >> the data in your rows (and what are the relations) >> >> Cor >> >> >> Thank you Core,
But this will not resolve my problem, because I must bind the joined data to the DataGrid. But in your supposed case I must programatically fill the grid. I want users would see the joined grid, and sort or filter the data (as they do in SQL Server (e.g. Enterprise Manager). Garik Show quote "Cor Ligthert [MVP]" wrote: > Garik, > > Not giving the fish I would say, that in your case I would probably do > something as filtering either using the Select or the DataView the Parent > table on the CustKeys I want and than use that to get the children. (That is > an existing method from datarow). Then you have the collection of datarows > that you want to show. > > Cor > Hi,
"Garik" <garik_ma@do not spam.yahoo.com> wrote in message Suppose you want to show OrderHeader fields but also news:4F794C82-B126-49C2-98EC-D07E64F9F742@microsoft.com... > For example I have two tables: Order Header and Customer, and a relation > OrderHeader.CustKey = Customer.CustKey. OrderHeader.Customer.Name, then you could "import" the Customer.Name into the OrderHeader table (if you have the right relation), eg.: OrderHeader table: - Add column: - Name : "CustomerName" - Expression : "parent(fk_customer_orderheader).Name" Once you have that, you should be able to filter and sort using the BindingSource. HTH, Greetings Show quote > > So, I want to show Orders in the DataGridView, and Filter or Sort that > grid > by 'Customer.CustomerName, Order.OrderDate DESC'. > > Thanks. > > "Cor Ligthert [MVP]" wrote: > >> >> > If not, how can I implement this for sorting, filtering????? >> > >> That is completely dependend from what you want, however as Frans said, a >> dataview is only doing one table, therefore tell what you want, and what >> is >> the data in your rows (and what are the relations) >> >> Cor >> >> >> Thank you Bart Mermuys,
It is the exact solution I was looking for. I tried using Expression Columns, but I don't realize when the expression is evaluated? Is the value in the column will be changed, if I modify the row in the Parent (Customer) table? Is the value in the column will be changed, if I modify Foreign Key column in the Child table (OrderHeader)? If expression is evaluated every time when I query the value in the column, the performance will be very slow in my view. -- Show quoteRegards, Garik Melkonyan MCP, MCAD, MCSD .NET "Bart Mermuys" wrote: > Hi, > > "Garik" <garik_ma@do not spam.yahoo.com> wrote in message > news:4F794C82-B126-49C2-98EC-D07E64F9F742@microsoft.com... > > For example I have two tables: Order Header and Customer, and a relation > > OrderHeader.CustKey = Customer.CustKey. > > Suppose you want to show OrderHeader fields but also > OrderHeader.Customer.Name, then you could "import" the Customer.Name into > the OrderHeader table (if you have the right relation), eg.: > > OrderHeader table: > - Add column: > - Name : "CustomerName" > - Expression : "parent(fk_customer_orderheader).Name" > > Once you have that, you should be able to filter and sort using the > BindingSource. > > HTH, > Greetings > > > > > So, I want to show Orders in the DataGridView, and Filter or Sort that > > grid > > by 'Customer.CustomerName, Order.OrderDate DESC'. > > > > Thanks. > > > > "Cor Ligthert [MVP]" wrote: > > > >> > >> > If not, how can I implement this for sorting, filtering????? > >> > > >> That is completely dependend from what you want, however as Frans said, a > >> dataview is only doing one table, therefore tell what you want, and what > >> is > >> the data in your rows (and what are the relations) > >> > >> Cor > >> > >> > >> > > > Hi,
Show quote "Garik" <garik_ma@do not spam.yahoo.com> wrote in message It looks like the expression is evaluated when either of the two changes you news:B23EFE4A-CED8-4753-90EF-5DF6D7299761@microsoft.com... > Thank you Bart Mermuys, > > It is the exact solution I was looking for. > > I tried using Expression Columns, but I don't realize when the expression > is > evaluated? > Is the value in the column will be changed, if I modify the row in > the Parent (Customer) table? Is the value in the column will be changed, > if I > modify Foreign Key column in the Child table (OrderHeader)? mention happen. > I believe the expression is _not_ evaluated each time you access the value, > If expression is evaluated every time when I query the value in the > column, > the performance will be very slow in my view. if that's what you mean. HTH, Greetings Show quote > > -- > Regards, > Garik Melkonyan > MCP, MCAD, MCSD .NET > > > "Bart Mermuys" wrote: > >> Hi, >> >> "Garik" <garik_ma@do not spam.yahoo.com> wrote in message >> news:4F794C82-B126-49C2-98EC-D07E64F9F742@microsoft.com... >> > For example I have two tables: Order Header and Customer, and a >> > relation >> > OrderHeader.CustKey = Customer.CustKey. >> >> Suppose you want to show OrderHeader fields but also >> OrderHeader.Customer.Name, then you could "import" the Customer.Name into >> the OrderHeader table (if you have the right relation), eg.: >> >> OrderHeader table: >> - Add column: >> - Name : "CustomerName" >> - Expression : "parent(fk_customer_orderheader).Name" >> >> Once you have that, you should be able to filter and sort using the >> BindingSource. >> >> HTH, >> Greetings >> >> > >> > So, I want to show Orders in the DataGridView, and Filter or Sort that >> > grid >> > by 'Customer.CustomerName, Order.OrderDate DESC'. >> > >> > Thanks. >> > >> > "Cor Ligthert [MVP]" wrote: >> > >> >> >> >> > If not, how can I implement this for sorting, filtering????? >> >> > >> >> That is completely dependend from what you want, however as Frans >> >> said, a >> >> dataview is only doing one table, therefore tell what you want, and >> >> what >> >> is >> >> the data in your rows (and what are the relations) >> >> >> >> Cor >> >> >> >> >> >> >> >> >> Why don't you join, filter and sort within sql statement?
-- Show quoteMiha Markic [MVP C#, INETA Country Leader for Slovenia] RightHand .NET consulting & development www.rthand.com Blog: http://cs.rthand.com/blogs/blog_with_righthand/ "Garik" <garik_ma@do not spam.yahoo.com> wrote in message news:DF904E82-9842-4089-89C8-F6C893D40F34@microsoft.com... > Hi, > > Please, help. Can I create a DataView on top of more than one DataTable. > If not, how can I implement this for sorting, filtering????? > > -- > Regards, > Garik Melkonyan > MCP, MCAD, MCSD .NET I'm not working with sql database:((
Show quote "Miha Markic [MVP C#]" wrote: > Why don't you join, filter and sort within sql statement? > > |
|||||||||||||||||||||||