PDA

View Full Version : PLease Help !!!


rawkz.star
05-13-2006, 10:21 AM
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
<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
<% @ 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
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
<% @ 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
Error Type:
Microsoft JET Database Engine (0x80004005)
Operation must use an updateable query.
/valid.asp, line 20



please help me!!!!
thanks in advance

miranda
05-14-2006, 04:46 PM
you need to set the permissions of the folder that the database is in to read/write. From your code it looks like the database is in the root folder. This is a very bad thing to do. Put it in a directory preferably outside of the IIS root directory.

If this is hosted by a hosting company then make a directory to store the database and move the database to that directory. Then if the hostiong company does not have a user control panel to allow you to set the permissions, contact them and have them set the appropriate permissions for you.