Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. query

query

Scheduled Pinned Locked Moved C#
databasehelp
9 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    Nekshan
    wrote on last edited by
    #1

    str = dss.Tables[0].Rows[0].Item[1].ToString(); It is giving error at all ".Item[1]" s of the block : 'System.Data.DataRow' does not contain a definition for 'Item'

    V J P 5 Replies Last reply
    0
    • N Nekshan

      str = dss.Tables[0].Rows[0].Item[1].ToString(); It is giving error at all ".Item[1]" s of the block : 'System.Data.DataRow' does not contain a definition for 'Item'

      V Offline
      V Offline
      virendra patel
      wrote on last edited by
      #2

      here items(1) its working in vb u try by putting dot(.)after rows(0). i think columns(1) is there. try in debug mode so u know exactly.

      N 1 Reply Last reply
      0
      • N Nekshan

        str = dss.Tables[0].Rows[0].Item[1].ToString(); It is giving error at all ".Item[1]" s of the block : 'System.Data.DataRow' does not contain a definition for 'Item'

        J Offline
        J Offline
        joon vh
        wrote on last edited by
        #3

        Nekshan wrote:

        'System.Data.DataRow' does not contain a definition for 'Item'

        You get this error because 'Item' doesn't exist. Use this instead:

        str = dss.Tables[0].Rows[0][1].ToString();
        

        or

        str = dss.Tables[0].Rows[0].ItemArray[1].ToString();
        

        Visual Studio can't evaluate this, can you? public object moo { __get { return moo; } __set { moo = value; } }

        N 1 Reply Last reply
        0
        • V virendra patel

          here items(1) its working in vb u try by putting dot(.)after rows(0). i think columns(1) is there. try in debug mode so u know exactly.

          N Offline
          N Offline
          Nekshan
          wrote on last edited by
          #4

          No, '.columns[1]' is also not there after .rows[0] After tables[0].rows[0] is there and ------tables[0].columns[0] is there. how to use? if possible chk it wen u have time, i m leaving office now. Going home, if net is working send u the copy of documentatn. ok. cu soon. tc. thanx. regards nekshan.

          V 1 Reply Last reply
          0
          • N Nekshan

            str = dss.Tables[0].Rows[0].Item[1].ToString(); It is giving error at all ".Item[1]" s of the block : 'System.Data.DataRow' does not contain a definition for 'Item'

            P Offline
            P Offline
            Pete OHanlon
            wrote on last edited by
            #5

            Don't use .Item[1]. Instead, you would write this as dss.Tables[0].Rows[0][1].ToString();. Note that it is a bad idea to rely on the ordinal position though - try using the column name instead. That way, if you reorder the columns in your query you aren't going to get unexpected results.

            Deja View - the feeling that you've seen this post before.

            1 Reply Last reply
            0
            • J joon vh

              Nekshan wrote:

              'System.Data.DataRow' does not contain a definition for 'Item'

              You get this error because 'Item' doesn't exist. Use this instead:

              str = dss.Tables[0].Rows[0][1].ToString();
              

              or

              str = dss.Tables[0].Rows[0].ItemArray[1].ToString();
              

              Visual Studio can't evaluate this, can you? public object moo { __get { return moo; } __set { moo = value; } }

              N Offline
              N Offline
              Nekshan
              wrote on last edited by
              #6

              Thank you joon_ :-)

              1 Reply Last reply
              0
              • N Nekshan

                No, '.columns[1]' is also not there after .rows[0] After tables[0].rows[0] is there and ------tables[0].columns[0] is there. how to use? if possible chk it wen u have time, i m leaving office now. Going home, if net is working send u the copy of documentatn. ok. cu soon. tc. thanx. regards nekshan.

                V Offline
                V Offline
                virendra patel
                wrote on last edited by
                #7

                ok. columns(0).item(0).tostring() or columns(0).rows(0).tostring() try this.

                1 Reply Last reply
                0
                • N Nekshan

                  str = dss.Tables[0].Rows[0].Item[1].ToString(); It is giving error at all ".Item[1]" s of the block : 'System.Data.DataRow' does not contain a definition for 'Item'

                  V Offline
                  V Offline
                  virendra patel
                  wrote on last edited by
                  #8

                  i will call u in night ok.bye..

                  1 Reply Last reply
                  0
                  • N Nekshan

                    str = dss.Tables[0].Rows[0].Item[1].ToString(); It is giving error at all ".Item[1]" s of the block : 'System.Data.DataRow' does not contain a definition for 'Item'

                    V Offline
                    V Offline
                    virendra patel
                    wrote on last edited by
                    #9

                    conn.Open(); SqlCommand cmm = new SqlCommand("select url, sitehit, survey, tellafriend, addtooutlook from tblsummary", conn); SqlDataAdapter ad = new SqlDataAdapter(cmm); DataSet ds = new DataSet(); ad.Fill(ds, "tblsummary"); string str Dim ds As DataSet1 if (ds.Tables(0).Rows.Count != 0) { string str =""; Str = ds.Tables(0).Rows(0)(0).tostring() str += ds.Tables(0).Rows(0)(1).ToString(); str += ds.Tables(0).Rows(0)(2).ToString(); str += ds.Tables(0).Rows(0)(3).ToString(); str += ds.Tables(0).Rows(0)(4).ToString(); } MessageBox.Show(str);

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups