Retrive data from Datatable.......

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Inbaraj
    New Member
    • Apr 2007
    • 76

    Retrive data from Datatable.......

    hi...

    I have broght the database value to Datatable. Now i want to view that value in text box. Can any one say me how to view the datatable. I tryed the codeing.
    [code=cpp]
    for(int i=0;i<datatable .Rows.Count;i++ )
    MessageBox.Show (datatable.Rows[i].ToString())[/code]
    but it is printing "System.DataTab le.Row" Plz help me...

    thanks in advance...

    reg
    Inbaraj
    Last edited by Frinavale; Oct 16 '07, 07:04 PM. Reason: Added [code] tags to make more legible
  • GayathriP
    New Member
    • Oct 2007
    • 17

    #2
    The code should be
    [code=cpp]
    for(int intOuter=0; intOuter<datata ble.Rows.Count; intOuter++)
    {
    for(int intInner=0; intInner<datata ble.Columns.Cou nt; intInner++)
    {
    MessageBox.Show (datatable.Rows[intOuter].ItemArray[intInner].ToString())
    }
    }[/code]

    Comment

    • Frinavale
      Recognized Expert Expert
      • Oct 2006
      • 9749

      #3
      Originally posted by GayathriP
      The code should be
      [code=cpp]
      for(int intOuter=0; intOuter<datata ble.Rows.Count; intOuter++)
      {
      for(int intInner=0; intInner<datata ble.Columns.Cou nt; intInner++)
      {
      MessageBox.Show (datatable.Rows[intOuter].ItemArray[intInner].ToString())
      }
      }[/code]

      Thanks for the help GayathriP!

      Could you both please use &#91;code] tags when posting code.
      An example of posting C# code:
      &#91;code=cp p]
      //My C# code here
      &#91;/code]

      An example of posting VB.NET code:
      &#91;code=vb net]
      'My Vb.NET code here
      &#91;/code]

      Thank you!
      -Moderator

      Comment

      • GayathriP
        New Member
        • Oct 2007
        • 17

        #4
        sorry for that. i will follow the same in future

        Comment

        Working...