laado Posted August 19, 2009 Share Posted August 19, 2009 i have following code which add record in database. but it gives error that Cannot update. Database or object is read-only./logon/create.asp, line 29whats wrong in this code?? <% 'Save entered username and password Username = Request.Form("txtUsername") Password = Request.Form("txtPassword") Fullname = Request.Form("txtFullname") 'Check if username and password are entered if Username = "" then Response.redirect("login.asp?login=createnamefailed") if Password = "" then Response.Redirect("login.asp?login=createpassfailed") 'Build connection set conn = server.CreateObject ("ADODB.Connection") conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & server.MapPath ("users.mdb") set rs = server.CreateObject ("ADODB.Recordset") 'Open all records rs.Open "SELECT * FROM userlist", conn, 3, 3 'Check if username doesn't already exist do while not rs.EOF if rs("username")=Username then set rs=nothing set conn=nothing Response.Redirect("login.asp?login=createnamefailed") end if rs.MoveNext loop 'Add a record rs.AddNew 'Put username and password in record rs("username")=Username rs("password")=Password rs("fullname")=Fullname 'Save record rs.Update set rs=nothing set conn=nothing Response.Redirect("login.asp?login=creatednew")%> Link to comment Share on other sites More sharing options...
justsomeguy Posted August 19, 2009 Share Posted August 19, 2009 I don't think the problem is in the code. I'm pretty sure the problem is that the database is read-only. Link to comment Share on other sites More sharing options...
laado Posted August 20, 2009 Author Share Posted August 20, 2009 so what shoud i do? I don't think the problem is in the code. I'm pretty sure the problem is that the database is read-only. Link to comment Share on other sites More sharing options...
justsomeguy Posted August 20, 2009 Share Posted August 20, 2009 I don't use Access, but I assume you find the MDB file and uncheck the read-only box on the properties page. Link to comment Share on other sites More sharing options...
laado Posted August 21, 2009 Author Share Posted August 21, 2009 problem solved. there was a fault in my pc I don't use Access, but I assume you find the MDB file and uncheck the read-only box on the properties page. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.