how to write codes to connect access database using html codes

Discussion in 'Software' started by hiralcp, Dec 18, 2007.

  1. hiralcp

    hiralcp

    Joined:
    Dec 18, 2007
    Messages:
    3
    Likes Received:
    0
    Please somebody help me with my codes. I am trying to Insert the data to access database using Html and javascript. but it doesnt work...my codes are as below:

    <html>
    <head>

    <title>Feedback Form</title>

    <script type="text/javascript">



    function getSubmit()
    {

    var name,email,comments;

    name1=uname.value;
    email=email.value;
    comments=commnets.value;

    var cn = new ActiveXobject("ADODB.Connection");

    var rs = new ActiveXObject("ADODB.Recordset");

    var strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source = C:\Documents and Settings\Velosys2-office\My Documents\feedback\Users.mdb";

    var SQL = "INSERT INTO user_tbl(uName,Email,Comments) VALUES (" & "'" & name1 & "'," & "'" & email & "'," & "'" & commnets & "')";

    cn.Open(strConn);
    rs.Open(SQL, cn);
    rs(1)=name.value;
    rs(2)=email.value ;
    rs(3)=comments.value;

    rs.Close();
    cn.Close();
    response.write("your data is submited");

    }

    </script>
    </head>

    <body>

    <div align="center">
    <table width="80%" border="0">
    <td><b>FEEDBACK FORM</b></td>
    <tr>
    <td>Name :</td>
    <td><input type="text" name="uname" ></td>
    </tr>
    <tr>
    <td>Email :</td>
    <td> <input type="text" name="email"></td>
    </tr>
    <tr>
    <td>Comments :</td>
    <td><textarea name="comments"></textarea></td>
    </tr>
    <tr>
    <td>&nbsp;</td>
    <td><input type="button" value="submit" onclick="getSubmit();"> </td>
    </tr>
    </table>
    </div>

    </body>
    </html>

    Looking forward for help.
    Thanks
     
    hiralcp, Dec 18, 2007
    #1
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.