Problem of geting the value of field in Recordset object with index vlaue

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • antony123
    New Member
    • Aug 2007
    • 10

    Problem of geting the value of field in Recordset object with index vlaue

    Hai All hard coders ,
    Tell me how to get the value of field in a record in a recordset onject in visual basic using is index rather than the field name.Please help me .
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    as you are saying yourself use the index. What is the problem ?

    iht index should start ffrom 0 (zero).

    [CODE=vb]text1.text=iif( isnull(rs(0))," ",rs(0))[/CODE]

    Comment

    • antony123
      New Member
      • Aug 2007
      • 10

      #3
      The actual code is this
      But it does not work.
      content = rsIndividual13. Fields.Item(1) & "---" & rsIndividual13. Fields.Item(2) & "---" & rsIndividual1!D ateOfMarriage _
      & "---" & rsIndividual13. Fields.Item(3) & "---" & rsIndividual13. Fields.Item(4) & "---" _
      & "---" & rsIndividual13. Fields.Item(5) & "---" & rsIndividual13. Fields.Item(6) & "---" _
      & "---" & rsIndividual13. Fields.Item(7) & "---" & rsIndividual13. Fields.Item(8)

      Comment

      • debasisdas
        Recognized Expert Expert
        • Dec 2006
        • 8119

        #4
        you are using vb 6.0 or advance version ?

        Comment

        • debasisdas
          Recognized Expert Expert
          • Dec 2006
          • 8119

          #5
          for vb6.0 try like the following sample code

          [CODE=vb]content = rsIndividual13( 1) & "---" & rsIndividual13( 2) & "---" & rsIndividual13( 3) & "---" & rsIndividual13( 4) & "---" & rsIndividual13( 5) [/CODE]

          Comment

          • QVeen72
            Recognized Expert Top Contributor
            • Oct 2006
            • 1445

            #6
            Hi,

            u can also give this :

            [code=vb]
            txtName = rs("EName") & ""

            Or

            txtName = rs.Fields("Name ") & ""

            Or
            txtName = rs(0) & ""

            Or
            txtName =rs.Fields(0).N ame

            [/code]

            REgards
            Veena

            Comment

            Working...