need help regarding dataset.....

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tirumalab
    New Member
    • Apr 2007
    • 21

    need help regarding dataset.....

    Hi all...

    i need a small help ...

    the query is ,i have my datatable with data in the dataset and i want to search for a perticular field in the datatable and bind all the values of that perticuler row to the textboxes provided in my form .....

    kindly let me know the solution ...
  • prabunewindia
    New Member
    • Mar 2007
    • 199

    #2
    hi friend,
    you can use dataView.
    in data view u have one option 'rowfilter'

    DataView dv=new DataView();
    dv.RowFilter="N ame LIKE '%"+urNeed+"%'" ;

    // name is the fieldName, urNeed is the variable(string )
    it will sort the table where are all urNeed occur
    Ex: urNeed="the"
    the it will show all rows like

    thescript
    pthen
    ethens
    methen /// the occurs in all
    if u want to get only "the"
    the don't use % in rowfilter

    Originally posted by tirumalab
    Hi all...

    i need a small help ...

    the query is ,i have my datatable with data in the dataset and i want to search for a perticular field in the datatable and bind all the values of that perticuler row to the textboxes provided in my form .....

    kindly let me know the solution ...

    Comment

    • tirumalab
      New Member
      • Apr 2007
      • 21

      #3
      Hi prabu

      Thank you ,but my requirement is i've one colum as primarykey coloum and when you enter the coloum value in a perticuler textbox ,first it has to be validated whether the value is there or not if it is there and you want to dispaly all the col:values of that perticuler row in the remaining textboxes......

      (i saved the data in an XML file and created dataset object and filled the datatable with readxml()method of dataset....no way connected to the database)

      this is my req:..kindly suggest me the correct procedure to me...

      looking forward to your reply...
      (its a winform app with C#)

      Originally posted by prabunewindia
      hi friend,
      you can use dataView.
      in data view u have one option 'rowfilter'

      DataView dv=new DataView();
      dv.RowFilter="N ame LIKE '%"+urNeed+"%'" ;

      // name is the fieldName, urNeed is the variable(string )
      it will sort the table where are all urNeed occur
      Ex: urNeed="the"
      the it will show all rows like

      thescript
      pthen
      ethens
      methen /// the occurs in all
      if u want to get only "the"
      the don't use % in rowfilter

      Comment

      • prabunewindia
        New Member
        • Mar 2007
        • 199

        #4
        hi
        try with this,
        int flag=0;
        foreach(DataRow dr in ds.tables[0].Rows)
        {
        if((string)dr["Name"]==textBoxtName. Text)
        {
        ///display everythin like
        textBoxAge=dr["age"];
        flag=1;
        }
        }

        if(flag==0)
        {
        //display messge that Name is not found or as u like

        }
        Originally posted by tirumalab
        Hi prabu

        Thank you ,but my requirement is i've one colum as primarykey coloum and when you enter the coloum value in a perticuler textbox ,first it has to be validated whether the value is there or not if it is there and you want to dispaly all the col:values of that perticuler row in the remaining textboxes......

        (i saved the data in an XML file and created dataset object and filled the datatable with readxml()method of dataset....no way connected to the database)

        this is my req:..kindly suggest me the correct procedure to me...

        looking forward to your reply...
        (its a winform app with C#)

        Comment

        • tirumalab
          New Member
          • Apr 2007
          • 21

          #5
          Thank you very much.....

          Originally posted by prabunewindia
          hi
          try with this,
          int flag=0;
          foreach(DataRow dr in ds.tables[0].Rows)
          {
          if((string)dr["Name"]==textBoxtName. Text)
          {
          ///display everythin like
          textBoxAge=dr["age"];
          flag=1;
          }
          }

          if(flag==0)
          {
          //display messge that Name is not found or as u like

          }

          Comment

          Working...