Send data to microsoft access

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

    Send data to microsoft access

    Please help!

    I am an ICT teacher at a secondary school and my year 12 (AS Level)
    group need to create a website where data can be sent from a form to a
    Microsoft Access database.

    I am trying to do this in my own time and then hopefully teach them
    how to do it.

    I have installed IIS on my machine and have followed a few web
    tutorials on how to get data from an Access database on to your
    webpage which i've found quite easy.

    The difficulty comes when i want to SEND data to my database using a
    form.

    I have created a database called "test.mdb"
    The database has one table called "customer"
    The customer table has 4 fields "ID" "Surname" "Forname" "Age"
    The datatypes of the fields are "number" "Text" "Text" "number"
    I have set no primary key (I believe that this might make it easier to
    solve)

    I am trying to keep it REALLY simple to start with and only sending
    one piece of data to start with, that being a "Surname"

    I have created a "form.asp" page with the following code:

    <html>
    <body><form method="post" action="send_da ta.asp">
    <table>
    <tr>
    <td>Surname:</td>
    <td><input name="Surname"> </td>
    </tr>
    </table>
    <br /><br />
    <input type="submit" value="Add New">
    <input type="reset" value="Cancel">
    </form></body>
    </html>


    I have then create a "send_data. asp" page that SHOULD recieve the data
    and send it to the database, this is the code:

    <html>
    <body>

    <%
    set conn=Server.Cre ateObject("ADOD B.Connection")
    conn.Provider=" Microsoft.Jet.O LEDB.4.0"
    conn.Open "C:/Inetpub/wwwroot/test.mdb"


    sql="INSERT INTO customer (Surname)"
    sql=sql & " VALUES "
    sql=sql & "('" & Request.Form("S urname") & "')"
    on error resume next
    conn.Execute sql,recaffected
    if err<>0 then
    Response.Write( "No update permissions!")
    else
    Response.Write( "<h3>" & recaffected & " record added</h3>")
    end if
    conn.close
    %>

    </body>
    </html>

    HOWEVER, when i press the "Add New" button on the "form.asp" page it
    takes me to the "send_data. asp" page but all it says is:

    No update permissions!

    As far as i know i have checked the permissions of my database file
    and i have full privilages but it won't send the data.

    So to summarise i can request data from my database and it works fine
    but i can not send data to it (Have tried so many on line tutorials).

    Would really appreciate some help (in as much detail as possible
    please - where i might have gone wrong - how to resolve the problem)

    Thank you in advance

    Trig

  • Bob Lehmann

    #2
    Re: Send data to microsoft access

    >>No update permissions!

    Maybe it isn't a permissions error.

    Remove the On Error and your error trapping, and you will see what the error
    is.

    Oh, and make sure you've unchecked the "Show Friendly Error Messages" if
    using Internet Destroyer.

    Bob Lehmann

    "trig" <markwood1981@h otmail.comwrote in message
    news:1171322354 .684207.30100@l 53g2000cwa.goog legroups.com...
    Please help!
    >
    I am an ICT teacher at a secondary school and my year 12 (AS Level)
    group need to create a website where data can be sent from a form to a
    Microsoft Access database.
    >
    I am trying to do this in my own time and then hopefully teach them
    how to do it.
    >
    I have installed IIS on my machine and have followed a few web
    tutorials on how to get data from an Access database on to your
    webpage which i've found quite easy.
    >
    The difficulty comes when i want to SEND data to my database using a
    form.
    >
    I have created a database called "test.mdb"
    The database has one table called "customer"
    The customer table has 4 fields "ID" "Surname" "Forname" "Age"
    The datatypes of the fields are "number" "Text" "Text" "number"
    I have set no primary key (I believe that this might make it easier to
    solve)
    >
    I am trying to keep it REALLY simple to start with and only sending
    one piece of data to start with, that being a "Surname"
    >
    I have created a "form.asp" page with the following code:
    >
    <html>
    <body><form method="post" action="send_da ta.asp">
    <table>
    <tr>
    <td>Surname:</td>
    <td><input name="Surname"> </td>
    </tr>
    </table>
    <br /><br />
    <input type="submit" value="Add New">
    <input type="reset" value="Cancel">
    </form></body>
    </html>
    >
    >
    I have then create a "send_data. asp" page that SHOULD recieve the data
    and send it to the database, this is the code:
    >
    <html>
    <body>
    >
    <%
    set conn=Server.Cre ateObject("ADOD B.Connection")
    conn.Provider=" Microsoft.Jet.O LEDB.4.0"
    conn.Open "C:/Inetpub/wwwroot/test.mdb"
    >
    >
    sql="INSERT INTO customer (Surname)"
    sql=sql & " VALUES "
    sql=sql & "('" & Request.Form("S urname") & "')"
    on error resume next
    conn.Execute sql,recaffected
    if err<>0 then
    Response.Write( "No update permissions!")
    else
    Response.Write( "<h3>" & recaffected & " record added</h3>")
    end if
    conn.close
    %>
    >
    </body>
    </html>
    >
    HOWEVER, when i press the "Add New" button on the "form.asp" page it
    takes me to the "send_data. asp" page but all it says is:
    >
    No update permissions!
    >
    As far as i know i have checked the permissions of my database file
    and i have full privilages but it won't send the data.
    >
    So to summarise i can request data from my database and it works fine
    but i can not send data to it (Have tried so many on line tutorials).
    >
    Would really appreciate some help (in as much detail as possible
    please - where i might have gone wrong - how to resolve the problem)
    >
    Thank you in advance
    >
    Trig
    >

    Comment

    • Bob Barrows [MVP]

      #3
      Re: Send data to microsoft access

      trig wrote:
      >
      No update permissions!
      >
      All users of the database file need to be able to create, modify and
      delete a locking file that has a .ldb extension in the folder that
      contains the database file. This means that users need Change/Modify
      permissions for the folder, not just the .mdb file. Who the users are
      depends on what type of authentication your website is using. If using
      Anonymous, then the IUSR_machinenam e account requires permission for the
      folder. Otherwise, all the accounts of the users themselves need the
      permissions. See:




      --
      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

      • Dex Siazon, Philippines

        #4
        Re: Send data to microsoft access

        under internet options in internet explorer tools click security, then internet, then custom level, then under user authentication check automatic logon with current username & password AND VOILA!!!! There you have it....
        ---
        Posted via DotNetSlackers. com

        Comment

        • McKirahan

          #5
          Re: Send data to microsoft access

          "trig" <markwood1981@h otmail.comwrote in message
          news:1171322354 .684207.30100@l 53g2000cwa.goog legroups.com...
          Please help!
          >
          I am an ICT teacher at a secondary school and my year 12 (AS Level)
          group need to create a website where data can be sent from a form to a
          Microsoft Access database.
          >
          I am trying to do this in my own time and then hopefully teach them
          how to do it.
          >
          I have installed IIS on my machine and have followed a few web
          tutorials on how to get data from an Access database on to your
          webpage which i've found quite easy.
          >
          The difficulty comes when i want to SEND data to my database using a
          form.
          >
          I have created a database called "test.mdb"
          The database has one table called "customer"
          The customer table has 4 fields "ID" "Surname" "Forname" "Age"
          The datatypes of the fields are "number" "Text" "Text" "number"
          I have set no primary key (I believe that this might make it easier to
          solve)
          >
          I am trying to keep it REALLY simple to start with and only sending
          one piece of data to start with, that being a "Surname"
          >
          I have created a "form.asp" page with the following code:
          >
          <html>
          <body><form method="post" action="send_da ta.asp">
          <table>
          <tr>
          <td>Surname:</td>
          <td><input name="Surname"> </td>
          </tr>
          </table>
          <br /><br />
          <input type="submit" value="Add New">
          <input type="reset" value="Cancel">
          </form></body>
          </html>
          >
          >
          I have then create a "send_data. asp" page that SHOULD recieve the data
          and send it to the database, this is the code:
          >
          <html>
          <body>
          >
          <%
          set conn=Server.Cre ateObject("ADOD B.Connection")
          conn.Provider=" Microsoft.Jet.O LEDB.4.0"
          conn.Open "C:/Inetpub/wwwroot/test.mdb"
          >
          >
          sql="INSERT INTO customer (Surname)"
          sql=sql & " VALUES "
          sql=sql & "('" & Request.Form("S urname") & "')"
          on error resume next
          conn.Execute sql,recaffected
          if err<>0 then
          Response.Write( "No update permissions!")
          else
          Response.Write( "<h3>" & recaffected & " record added</h3>")
          end if
          conn.close
          %>
          >
          </body>
          </html>
          >
          HOWEVER, when i press the "Add New" button on the "form.asp" page it
          takes me to the "send_data. asp" page but all it says is:
          >
          No update permissions!
          >
          As far as i know i have checked the permissions of my database file
          and i have full privilages but it won't send the data.
          >
          So to summarise i can request data from my database and it works fine
          but i can not send data to it (Have tried so many on line tutorials).
          >
          Would really appreciate some help (in as much detail as possible
          please - where i might have gone wrong - how to resolve the problem)
          >
          Thank you in advance
          >
          Trig
          >
          Add "response.w rite sql" before "conn.Execu te sql,recaffected ".

          Does the SQL statement look okay?

          If so then cut-and-paste it into an MS-Access Query and run it.

          It may identify the problem.

          Also, I'm not familiar with your use of "recaffecte d".


          Comment

          • Bob Barrows [MVP]

            #6
            Re: Send data to microsoft access

            McKirahan wrote:
            >
            Also, I'm not familiar with your use of "recaffecte d".
            It's well-documented. The second argument of the Execute statement is a
            byref argument that will contain the number of records affected by the
            statement being executed after the execution occurs.

            --
            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

            Working...