none
Dataset Search Prob RRS feed

  • Question

  • Hi I m having a Dataset wich has all the elements from  a DB table . After all my calcs are done on the Dataset I update the DB table.

    I need to sort the Dataset using one Column. I think the only way is using a Dataview. Know I need to find the first row starting wich a character (for ex S)
    the Dataview Find method couldnt help me on this

    Any idea?

    thnks

    Thursday, October 25, 2007 10:29 AM

All replies

  • Hi,

     

    If you want only one row and you want faster speed then i suggest you to write your any search algorithm.

    But if speed is not your concern then you can  use find method. It return all rows starting with S. You just use first row which match the type.

     

    Regards,

    Manju Sandhu

     

    Thursday, October 25, 2007 10:37 AM
  • Hi thnks i trie find like this



         DataView AAA = new DataView(this.D_holdgs.Tables["TBL_Holding"]);
                    AAA.Sort = "Holding";

                    int a = AAA.Find("S");

    but i get -1;   ( in DB there are about 100 entries in col Holding starting witch character s)

    Waht am i doing wrong
    Thursday, October 25, 2007 10:42 AM
  • Hi,

     

    use this

     

    int a = AAA.Find("S%");

     

    Regards,

    Manju Sandhu

    Thursday, October 25, 2007 10:46 AM
  • Sry, makes no difference still -1;
    if i enter a complete string wich is in the db it works.
    any idea?;

    Thursday, October 25, 2007 11:42 AM
  • Hi,

     

    Sorry for mis understanding.

    This time you prob will be solved use this.

    Instead of sort use this

     

    dataview.RowFilter = "ISTIMESTAMP like 'S%'";  //ISTIMESTAMP is column name

     

    Now your dataview contain only those rows which starts with S

     

     

    Regards,

    Manju Sandhu

    Thursday, October 25, 2007 12:02 PM