3 Replies Latest reply on Feb 22, 2007 10:22 AM by Newsgroup_User

    ADO Xtra database

    Xposure Interactive Level 1
      I have created a connection object and sucessfully recored data to my database (access). When I create a recordset object to retrieve the data I only seem to get acouple of the database fields. This is my code:
      member("status").text = member("status").text & RETURN & rst.fields["name"]
      member("status").text = member("status").text & RETURN & rst.fields["ID"]
      member("status").text = member("status").text & RETURN & rst.fields["dob"]
      member("status").text = member("status").text & RETURN & rst.fields["IDnumber"]
      member("status").text = member("status").text & RETURN & rst.fields["pass"]
      member("status").text = member("status").text & RETURN & rst.fields["score"]
      member("status").text = member("status").text & RETURN & rst.fields["attempts"]
      member("status").text = member("status").text & RETURN & rst.fields["userLevel"]
      I get output for 'name' and 'id' but no other. Any help out there?
      Kind regards,
      Duncan
        • 1. Re: ADO Xtra database
          Xtramania Level 1
          Check the error state after using any of ADOxtra methods. ADO will probably say some useful information. You may use debug mode by calling: xtra("ADOxtra").Init(true) before you create rst object.
          • 2. Re: ADO Xtra database
            Xposure Interactive Level 1
            There are no error messages recieved but when I tried to pass the field values to variables they are <void>:
            --> rst=CreateObject(xtra "ADOxtra",#Recordset)
            == rst = <Prop Ref 1 277c7c4>
            --> if objectP(rst) then
            --> getThis = "SELECT Id, name FROM test WHERE name='" & gname & "'"
            == getThis = "SELECT Id, name FROM test WHERE name='DUNCANBRADBURY'"
            --> rst.Open(getThis,gConnectionString,rst.adOpenKeyset,rst.adLockPessimistic)
            --> if rst.succeeded then
            --> if rst.fields["name"] = "" then
            --> gname = rst.fields["name"]
            == gname = "DUNCANBRADBURY"
            --> gdob = rst.fields["dob"]
            == gdob = <Void>
            --> gIDnumber = rst.fields["IDnumber"]
            == gIDnumber = <Void>
            --> gpass = rst.fields["pass"]
            == gpass = <Void>
            --> gscore = rst.fields["score"]
            == gscore = <Void>
            --> gattempts = rst.fields["attempts"]
            == gattempts = <Void>
            --> guserLevel = rst.fields["userLevel"]
            == guserLevel = <Void>
            --> alert "Welcome back:" && gname
            --> member("status").text = member("status").text & RETURN & rst.fields["name"]
            --> member("status").text = member("status").text & RETURN & rst.fields["ID"]
            --> member("status").text = member("status").text & RETURN & rst.fields["dob"]
            --> member("status").text = member("status").text & RETURN & rst.fields["IDnumber"]
            --> member("status").text = member("status").text & RETURN & rst.fields["pass"]
            --> member("status").text = member("status").text & RETURN & rst.fields["score"]
            --> member("status").text = member("status").text & RETURN & rst.fields["attempts"]
            --> member("status").text = member("status").text & RETURN & rst.fields["userLevel"]
            Hope that provides a little more detail?
            • 3. Re: ADO Xtra database
              Level 7
              In your SQL query you ask for fields named "Id" and "name":
              > --> getThis = "SELECT Id, name FROM test WHERE name='" & gname & "'"

              but then try to access fields that /aren't/ part of your query
              > --> gdob = rst.fields["dob"]
              > --> gIDnumber = rst.fields["IDnumber"]
              > --> gpass = rst.fields["pass"]
              > --> gscore = rst.fields["score"]
              > --> gattempts = rst.fields["attempts"]
              > --> guserLevel = rst.fields["userLevel"]

              Perhaps your SELECT statement should look like:
              getThis = "SELECT Id, name, dob, IDnumber, pass, score, attempts,
              userLevel FROM test WHERE name='" & gname & "'"