Need Help. - Can't find my error

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Gaby

    #16
    Re: Need Help. - Can't find my error

    Ok,
    I removed the <>

    It now looks like...
    <%
    dim cn, ar(4)
    ar(0)="22233444 4"
    ar(1)="Norton"
    ar(2)="581371"
    ar(3)="3"
    ar(4)="3"
    set cn=createobject ("adodb.connect ion")
    cn.open "provider=micro soft.jet.oledb. 4.0;" & _
    "data source=" & server.mapppath ("hgb_experimen t.mdb")
    cn.qInsertRecor d ar(0),ar(1),ar( 2),ar(3),ar(4)
    cn.close:set cn=nothing
    %>

    I ran it and got this error
    Microsoft VBScript runtime error '800a01b6'

    Object doesn't support this property or method: 'server.mapppat h'

    /web/test/hbrown/test.asp, line 10


    Let me know you guys think I should do next. Im hopng to get it
    running by Monday so Ill be tinkering with it all afternoon.

    Thanks again,
    Gabriel

    Comment

    • Bob Barrows [MVP]

      #17
      Re: Need Help. - Can't find my error

      Gaby wrote:
      Ok,
      I removed the <>
      >
      It now looks like...
      <%
      dim cn, ar(4)
      ar(0)="22233444 4"
      ar(1)="Norton"
      ar(2)="581371"
      ar(3)="3"
      ar(4)="3"
      Nothing to do with the error you are getting of course, but: what are the
      datatypes of the fields in this example? If they are Text, then you are
      correct to put quotes around the numeric values. If they are Number fields,
      you should NOT put quotes around the values when assigning them to the array
      elements. You should be passing strings to Text parameters and numbers to
      numeric parameters.
      set cn=createobject ("adodb.connect ion")
      cn.open "provider=micro soft.jet.oledb. 4.0;" & _
      "data source=" & server.mapppath ("hgb_experimen t.mdb")
      cn.qInsertRecor d ar(0),ar(1),ar( 2),ar(3),ar(4)
      cn.close:set cn=nothing
      %>
      >
      I ran it and got this error
      Microsoft VBScript runtime error '800a01b6'
      >
      Object doesn't support this property or method: 'server.mapppat h'
      Too many p's in mappath. Could have been a typo on my part
      --
      Microsoft MVP - ASP/ASP.NET
      Please reply to the newsgroup. This email account is my spam trap so I
      don't check it very often. If you must reply off-line, then remove the
      "NO SPAM"


      Comment

      • Gaby

        #18
        Re: Need Help. - Can't find my error

        OK!!! I think we are getting somewhere. It was a typo I overlooked.

        <%
        dim cn, ar(4)
        ar(0)="22233444 4"
        ar(1)="Norton"
        ar(2)="581371"
        ar(3)="3"
        ar(4)="3"
        set cn=createobject ("adodb.connect ion")
        cn.open "provider=micro soft.jet.oledb. 4.0;" & _
        "data source=" & server.mappath( "hgb_experiment .mdb")
        cn.qInsertRecor d ar(0),ar(1),ar( 2),ar(3),ar(4)
        cn.close:set cn=nothing
        %>

        The information was passed into the table!!

        Whats the next step?
        Im getting excited. Hopefully, I can get it the form working.

        Comment

        • Bob Barrows [MVP]

          #19
          Re: Need Help. - Can't find my error

          Gaby wrote:
          OK!!! I think we are getting somewhere. It was a typo I overlooked.
          >
          <%
          dim cn, ar(4)
          ar(0)="22233444 4"
          ar(1)="Norton"
          ar(2)="581371"
          ar(3)="3"
          ar(4)="3"
          Again, are these numbers going into Text fields? If not, then you need to
          remove the quotes:

          ar(4) = 3
          set cn=createobject ("adodb.connect ion")
          cn.open "provider=micro soft.jet.oledb. 4.0;" & _
          "data source=" & server.mappath( "hgb_experiment .mdb")
          cn.qInsertRecor d ar(0),ar(1),ar( 2),ar(3),ar(4)
          cn.close:set cn=nothing
          %>
          >
          The information was passed into the table!!
          >
          Whats the next step?
          Im getting excited. Hopefully, I can get it the form working.
          OK, now you understand (I hope) the mechanism for passing the data to the
          parameters in your saved query. The idea is to pass them in the same order
          in which they appear in your saved query, which you can now confirm has been
          accomplished.

          Let's move on to incorporating it into your existing form ... but let's do
          it in small steps. I assume you have a form where the user enters and
          submits the data. So change the action property of the form tag to make it
          submit to this test page. Then, in this test page, change the hard-coded
          values to references to the form variables coming from the submission.

          ar(0) = Request.Form("n ame of variable")

          Run your form, enter some test data, submit it, and verify that it gets
          added into your database. I would suggest adding this code to the test page,
          right after the line that executes the saved query:

          dim sql, cmd, arParms, html
          sql="Select Roster, Instructor, [Password]," & _
          "1_AbletoGiveOr ders, 2_Appreciative " & _
          "From Research Where Roster = ?"
          arParms=Array(a r(0))
          set cmd=createobjec t("adodb.comman d")
          cmd.commandtype =1 'adCmdText
          cmd.commandtext =sql
          set cmd.activeconne ction=cn
          set rs=cmd.execute( ,arParms)
          if rs.eof then
          response.write "No record was inserted"
          else
          response.write "<table border=""1"" "
          response.write "style=""bo rder-collapse:collap se;""><tr>"
          response.write "<th>Roster </th>"
          response.write "<th>Instructor </th>"
          response.write "<th>Passwo rd</th>"
          response.write "<th>1_AbletoGi veOrders</th>"
          response.write "<th>2_Apprecia tive</th></tr><tr><td>"
          html=rs.getstri ng(2,,"</td><td>","</td></tr><tr><td>")
          html=left(html, len(html) - 8)
          response.write html
          response.write "</table>"
          end if
          rs.close:set rs=nothing

          Once you have that accomplished, the next step will be to add some code to
          validate that the user enters data that is correct. Users sometime make
          mistakes an do things like entering alpha characters when you are expecting
          numbers, or entering nothing at all. And some users will maliciously enter
          data designed to either damage your database or break into it. See



          You need to deal with these situations before you even create your
          connection object ... but, one step at a time.

          --
          Microsoft MVP - ASP/ASP.NET
          Please reply to the newsgroup. This email account is my spam trap so I
          don't check it very often. If you must reply off-line, then remove the
          "NO SPAM"


          Comment

          • Gaby

            #20
            Re: Need Help. - Can't find my error

            I tried what you said and it worked. The only thing I need to add if
            making it ok to leave data out. I would get a error if I left
            checkboxes unchecked. During the actual survey, it will be ok for
            students to leave boxes blank if they do not apply. Is there anyway to
            code it so that incomplete data is allowed?

            Thanks again,
            Gabriel

            Comment

            • Bob Barrows [MVP]

              #21
              Re: Need Help. - Can't find my error

              Gaby wrote:
              I tried what you said and it worked. The only thing I need to add if
              making it ok to leave data out. I would get a error if I left
              checkboxes unchecked. During the actual survey, it will be ok for
              students to leave boxes blank if they do not apply. Is there anyway
              to code it so that incomplete data is allowed?
              >
              You need to check for the existence of the checkbox variables and pass
              true if they exist and false if they don't. Generically:

              checkboxvalue = false
              if len(request.for m("checkbox") ) 0 then
              checkboxvalue=t rue
              else
              checkboxvalue = false
              end if


              This can be done in the data validation step I described in my previous
              post.

              --
              Microsoft MVP -- ASP/ASP.NET
              Please reply to the newsgroup. The email account listed in my From
              header is my spam trap, so I don't check it very often. You will get a
              quicker response by posting to the newsgroup.


              Comment

              • Evertjan.

                #22
                Re: Need Help. - Can't find my error

                Bob Barrows [MVP] wrote on 31 jul 2006 in
                microsoft.publi c.inetserver.as p.general:
                Generically:
                >
                checkboxvalue = false
                if len(request.for m("checkbox") ) 0 then
                checkboxvalue=t rue
                else
                checkboxvalue = false
                end if
                >
                Twice "checkboxva lue = false" is a bit overdone, Bob.

                In one row, try:

                checkboxvalue = len(request.for m("checkbox") ) 0


                --
                Evertjan.
                The Netherlands.
                (Please change the x'es to dots in my emailaddress)

                Comment

                • Bob Barrows [MVP]

                  #23
                  Re: Need Help. - Can't find my error

                  Evertjan. wrote:
                  Bob Barrows [MVP] wrote on 31 jul 2006 in
                  microsoft.publi c.inetserver.as p.general:
                  >
                  > Generically:
                  >>
                  >checkboxvalu e = false
                  >if len(request.for m("checkbox") ) 0 then
                  > checkboxvalue=t rue
                  >else
                  > checkboxvalue = false
                  >end if
                  >>
                  >
                  Twice "checkboxva lue = false" is a bit overdone, Bob.
                  >
                  In one row, try:
                  >
                  checkboxvalue = len(request.for m("checkbox") ) 0
                  >
                  Oops, my cut-and-paste became a copy-and-paste somehow.
                  Normally I would do what you suggested, but i wanted to make it clear
                  for Gaby.

                  --
                  Microsoft MVP -- ASP/ASP.NET
                  Please reply to the newsgroup. The email account listed in my From
                  header is my spam trap, so I don't check it very often. You will get a
                  quicker response by posting to the newsgroup.


                  Comment

                  • Gaby

                    #24
                    Re: Need Help. - Can't find my error

                    I think I get it .

                    Thanks guys.

                    Comment

                    • Gaby

                      #25
                      Re: Need Help. - Can't find my error

                      I went ahead and fille din the rest of the 130 quesions. It worked
                      fine with 5 questions but now I get
                      Microsoft VBScript runtime error '800a0009'

                      Subscript out of range: '[number: 5]'

                      /web/test/hbrown/Insert.asp, line 15

                      i thought maybe it would have to do with the 'ar()' part. Right now I
                      have it set to ar(138).

                      I dont know what else I can do to fix this.

                      Comment

                      • Bob Barrows [MVP]

                        #26
                        Re: Need Help. - Can't find my error

                        Gaby wrote:
                        I went ahead and fille din the rest of the 130 quesions. It worked
                        fine with 5 questions but now I get
                        Microsoft VBScript runtime error '800a0009'
                        >
                        Subscript out of range: '[number: 5]'
                        >
                        /web/test/hbrown/Insert.asp, line 15
                        >
                        i thought maybe it would have to do with the 'ar()' part. Right now I
                        have it set to ar(138).
                        >
                        I dont know what else I can do to fix this.
                        What is line 15?
                        --
                        Microsoft MVP -- ASP/ASP.NET
                        Please reply to the newsgroup. The email account listed in my From
                        header is my spam trap, so I don't check it very often. You will get a
                        quicker response by posting to the newsgroup.


                        Comment

                        • Evertjan.

                          #27
                          Re: Need Help. - Can't find my error

                          Gaby wrote on 02 aug 2006 in microsoft.publi c.inetserver.as p.general:
                          I went ahead and fille din the rest of the 130 quesions. It worked
                          fine with 5 questions but now I get
                          Microsoft VBScript runtime error '800a0009'
                          >
                          Subscript out of range: '[number: 5]'
                          >
                          /web/test/hbrown/Insert.asp, line 15
                          >
                          i thought maybe it would have to do with the 'ar()' part. Right now I
                          have it set to ar(138).
                          >
                          I dont know what else I can do to fix this.
                          >
                          What are you talking about?

                          Please quote what you are replying to.

                          If you want to post a followup via groups.google.c om, don't use the
                          "Reply" link at the bottom of the article. Click on "show options" at the
                          top of the article, then click on the "Reply" at the bottom of the article
                          headers.

                          <http://www.safalra.com/special/googlegroupsrep ly/>

                          --
                          Evertjan.
                          The Netherlands.
                          (Please change the x'es to dots in my emailaddress)

                          Comment

                          • Gaby

                            #28
                            Re: Need Help. - Can't find my error


                            Bob Barrows [MVP] wrote:
                            What is line 15?
                            This is all it is.
                            ar(6)= Request.Form("6 _AbleToDoubtOth ers")

                            If you want the whole code its a little long. If you think it will
                            help I can get it to you. Shoot me an email and ill send you a text
                            file.

                            Comment

                            • Gaby

                              #29
                              Re: Need Help. - Can't find my error

                              Ok, so I got this thing working but now Im having more questions.
                              Sorry if this topic is geting old but here i go....

                              i have it where the suvey questions get submitted into the access
                              table. the code i used is like the one above only with 135 questions.
                              but now theres a second survey i need to add. once they complete the
                              first, i want it to go to the second. since there will be two submit
                              button , how to i get it to edit the existing record and not add a new
                              one. the students have to enter their roster number on both surveys as
                              this is there primary key.

                              Comment

                              Working...