Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 13th, 2006, 03:16 AM
Registered User
 
Join Date: May 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Help Please !!!

hello ...
i m new to asp ...
i have written a code to simply insert the values into the access database but i keep getting error

heres the html code
Code:
<html>

<head>
    <title>Login Form</title>
</head>

<body>
    <form name = "Login" action ="valid.asp" method ="post">
    <table align="center" >
        <tr><td> Enter your Name </td> <td> <input type="text" name = "Login" > </td> </tr>

        <tr><td> Enter your Age </td> <td> <input type="text" name = "Age" > </td> </tr>

        <tr><td> Enter your Email </td> <td> <input type="text" name = "Email" > </td> </tr>

        <tr><td align ="center" > <input type ="submit" name = "SAVE" value ="SAVE"> </td></tr>
    </table>    


    </form>
</body>

</html>
heres the asp code
Code:
<% @ language = vbscript %>
<% 
    Dim con, rs, strname, strage, strmail, rsstr

    set con= server.CreateObject("ADODB.connection")
    Con.Provider="Microsoft.Jet.OLEDB.4.0"
    Con.Open(Server.MapPath("\login.mdb"))

    set rs= server.createobject("ADODB.recordset")
    set rs.activeconnection = con 

    strname = request.form("Login")
    strage = request.form("Age")
    strmail = request.form("Mail")

    rs.open "select * from login_table", con, adOpenDynamic 
    rs.addnew
    rs(0)= strname
    rs(1)= strage
    rs(2)= strmail
    rs.update 
    rs.close    
%>
when i try the above code i get the error
Quote:
quote:Error Type:
ADODB.Recordset (0x800A0CB3)
Current Recordset does not support updating. This may be a limitation of the provider, or of the selected locktype.
/valid.asp, line 17
however i have even tried this code
Code:
<% @ language = vbscript %>
<% 
    Dim con, rs, strname, strage, strmail, rsstr

    set con= server.CreateObject("ADODB.connection")
    Con.Provider="Microsoft.Jet.OLEDB.4.0"
      Con.Open(Server.MapPath("\login.mdb"))

    set rs= server.createobject("ADODB.recordset")
    set rs.activeconnection = con 

    strname = request.form("Login")
    strage = request.form("Age")
    strmail = request.form("Mail")


    rsstr= "Insert into Login_table (Name,Age,Email)"
    rsstr = rsstr & " values('" & strname & "','" & strage & "','" & strmail & "')"

    con.execute (rsstr)
    con.close
%>
and in this case i get an error
Quote:
quote:Error Type:
Microsoft JET Database Engine (0x80004005)
Operation must use an updateable query.
/valid.asp, line 20
please help !!!!

The Road to success is always under construction :)
 
Old May 13th, 2006, 05:43 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

For the problem with the AddNew code, take a look at an example here:

http://www.adopenstatic.com/experime...autonumber.asp

Basically, you need to pass different option parameters to the Open method. To make sure the constants like adOpenKeyset and adLockOptimistic are available in your code, look here:

http://imar.spaanjaars.com/QuickDocId.aspx?QUICKDOC=332

Finally, to fix the 0x80004005 error, take a look here:

http://imar.spaanjaars.com/QuickDocId.aspx?QUICKDOC=263

Hope this help,s

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004









Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.