SA Developer .NET

Welcome to SA Developer .NET Sign in | Join | Help
in Search

dt.ds.Select()

Last post 09-02-2008, 8:56 by riccardospagni. 3 replies.
Sort Posts: Previous Next
  •  08-25-2008, 9:34 14279

    dt.ds.Select()

    Hi all

    I've never worked with datasets before and I was just wandering if I can do a SELECT DISTINCT column in a dt.ds.Select();  Also, how to make it work - I need an array to work from for a menu.  I wasted the whole of Friday trying to figure out how to do it and now I'm behind Sad

    Thanks much,
    A*


    Someone once told me love makes the world go around and, well, I just had to laugh in their face because EVERYBODY knows what REALLY makes the world go around is a mutant gerbil on a treadmill.
  •  08-25-2008, 12:46 14283 in reply to 14279

    Re: dt.ds.Select()

    Not that I know of, well not directly anyways. Data tables weren't designed to be replacements for fancier database engines. BUT .... what about LINQ? Using to LINQ to DataTable u could probably do something like this.
  •  08-25-2008, 12:54 14284 in reply to 14279

    Re: dt.ds.Select()

    I figured out how to make it work (YAY!).  But the DISTINCT part does not seem like it's going to happen - syntax error about a missing operand.  Very unfriendly indeed.

    Thanks all,
    A*


    Someone once told me love makes the world go around and, well, I just had to laugh in their face because EVERYBODY knows what REALLY makes the world go around is a mutant gerbil on a treadmill.
  •  09-02-2008, 8:56 14461 in reply to 14284

    Re: dt.ds.Select()

    I have to disagree with Ryan - datatables in a dataset WERE designed to be like local tables you can manipulate and create views from. Think of a dataset as a database on a local SQL server. Your datatables are the tables within that database. You can then create dataviews of a datatable - as you would create views of tables in the database - that allow you to sort and filter your datatable. Changes to the datatable obviously cascade down in realtime to the dataview. Similarly, changes to the dataview are pushed back to the datatable.

     

    Key differentiator: .NET assumes that by the time your data hits the datatable you've already done the denormalisation. It would be silly to pull your lookup tables across to the application and try denormalise there. That having been said, it is still often advantageous to pull a bigger set of denormalised data to the smart client application, and then create a dataview or dataviews of the data. It's (generally, I know there are exceptions) MUCH faster to let the user click on a bunch of checkboxes that filter the data and merely update a dataview, than to change the LINQ or T-SQL and resubmit it to the database. An initial wait of a few seconds for data to stream is always more preferable than a few seconds for each filter change.

     

    I used datatables and dataviews quite extensively in an open-source project (this is like the third time I've punted this on here, but I'm too lazy to Google for other examples) that you may find informative: http://www.codeplex.com/scriptio

     

    Ciao,

       Riccardo


    And so the kief looked and lo, it was kief.
View as RSS news feed in XML
Powered by Community Server (Commercial Edition), by Telligent Systems