Jump to content

error '80004005'


jojay
 Share

Recommended Posts

Hi,I am working on a simple asp form to send info from form to the database and I am getting this error and went around to find some articles and found that this could be due to persmission problem, etc. I checked all that and that isnt the issue. Can some one please explain why I get this error?My conection code:

Set con = Server.createobject("Adodb.Connection")con.open"dsn=Candidate"Set rs = Server.createobject("Adodb.Recordset")rs = con.execute ("Insert into Cform (Cssn,Cjobno,Cfname,Clname,Cphone,Cemail,Cnotes,Cjobref,Cimmsta,Cposition) values ('"&Cssn&"','"&Cjobno&"','"&Cfname&"','"&Clname&"','"&Cphone&"','"&Cemail&"','"&Cnotes&"','"&Cjobref&"','"&Cimmsta&"','"&Cpostion&"')")

error:Microsoft OLE DB Provider for ODBC Drivers error '80004005' [Microsoft][ODBC Microsoft Access Driver] Operation must use an updateable query

Link to comment
Share on other sites

If its not a permission problem, its probably a cursortype or locktype problem. This code explicitly specifies to the database that you are going to be updating records:

Set con = Server.createobject("Adodb.Connection")con.open"dsn=Candidate"Set rs = Server.createobject("Adodb.Recordset")rs.Open "Select Cssn,Cjobno,Cfname,Clname,Cphone,Cemail,Cnotes,Cjobref,Cimmsta,Cposition From CForm Where 0=1", con, 3, 3   rs.Addnew   rs("Cssn") = """&Cssn&"""   rs("Cjobno") = """&Cjobno&"""   rs("Cfname") = """&Cfname&"""   rs("Clname") = """&Clname&"""   rs("Cphone") = """&Cphone&"""   rs("Cemail") = """&Cemail&"""   rs("Cnotes") = """&notes&"""   rs("Cjobref") = """&Cjobref&"""   rs("Cimmsta") = """&Cimmsta&"""   rs("Cposition") = """&Cposition&""   rs.Updaters.closeCon.close

Link to comment
Share on other sites

hi i think this error cause the database is not opened form append "write" i think there are anthor way to add data to db its easier from dns-less connection this is the code

<%Dim conn            Dim rs  Set Conn = Server.CreateObject("ADODB.Connection")conn.Provider="Microsoft.Jet.OLEDB.4.0"conn.Open(Server.Mappath("/webdata/tst.mdb"))** db bath set rs = Server.CreateObject("ADODB.recordset")      RS.open "samer",Conn,2,2 ** table name // 2,2 mean open this db for append rs.AddNewrs.Fields("record name") = Request.Form("input type name in the form") examplers.Fields("email") = Request.Form("usermail")rs.Updaters.CloseSet rs = NothingSet Conn = NothingResponse.Redirect "confirm.asp" ** by this u can tell the user that the reg action complete%>
Link to comment
Share on other sites

If its not a permission problem, its probably a cursortype or locktype problem. This code explicitly specifies to the database that you are going to be updating records:
Set con = Server.createobject("Adodb.Connection")con.open"dsn=Candidate"Set rs = Server.createobject("Adodb.Recordset")rs.Open "Select Cssn,Cjobno,Cfname,Clname,Cphone,Cemail,Cnotes,Cjobref,Cimmsta,Cposition From CForm Where 0=1", con, 3, 3   rs.Addnew   rs("Cssn") = """&Cssn&"""   rs("Cjobno") = """&Cjobno&"""   rs("Cfname") = """&Cfname&"""   rs("Clname") = """&Clname&"""   rs("Cphone") = """&Cphone&"""   rs("Cemail") = """&Cemail&"""   rs("Cnotes") = """&notes&"""   rs("Cjobref") = """&Cjobref&"""   rs("Cimmsta") = """&Cimmsta&"""   rs("Cposition") = """&Cposition&""   rs.Updaters.closeCon.close

Hi,I guess the code is going through good but I am having another error such as:Microsoft OLE DB Provider for ODBC Drivers error '80004005' [Microsoft][ODBC Microsoft Access Driver] Cannot update. Database or object is read-only. I right clicked the database and checked the properties and it doesnt says Read only- the Read Only checkbox is unchecked. What is this problem? Where should I see if the database has the write permission.And so, with your code, I have a question regarding the where 0 = 1" ? What does it say, is it some similar to where cssn = '"& cssn&"'And secondly, why is the rs("Cssn") = """&Cssn&""" has so many double quotes. Will this okay to use:rs("Cssn") = Request.form("Cssn")What is the difference?
Link to comment
Share on other sites

Hi,I guess the code is going through good but I am having another error such as:Microsoft OLE DB Provider for ODBC Drivers error '80004005' [Microsoft][ODBC Microsoft Access Driver] Cannot update. Database or object is read-only. I right clicked the database and checked the properties and it doesnt says Read only- the Read Only checkbox is unchecked. What is this problem? Where should I see if the database has the write permission.
File permissions are little different on the internet, you have to make sure both your folder and database have write permissions. Right-clicking and unchecking the "read-only" box won't do anything, you have to chmod whatever folder your database is sitting in, set it to 660 (if that doesn't work, try chmodding it to 777). Most FTP programs will allow you to do that just by right-clicking on the folder and changing its permissions.If the FTP program won't let you chmod folders, then you have to ask your webhost to do it for you.
And so, with your code, I have a question regarding the where 0 = 1" ? What does it say, is it some similar to where cssn = '"& cssn&"'
The part that says "0=1" just tells the database not to return any rows, because you're not using them. If you excluded that part, it would force the entire table into the recordset object for no purpose (which is very resource consuming).
And secondly, why is the rs("Cssn") = """&Cssn&""" has so many double quotes. Will this okay to use:rs("Cssn") = Request.form("Cssn")What is the difference?

I just reproduced the same code from your opening post. When you use this:
Insert into Cform (Cssn,Cjobno,Cfname,Clname,Cphone,Cemail,Cnotes,Cjobref,Cimmsta,Cposition) values ('"&Cssn&"', ...

Its going to insert the "&Cssn&" into your field. You have that string surrounded in both single quotes, and double quotes. Thats just SQL, here are some more examples:

Select "&cssn&" From some_table;-> &cssn&Select '"&cssn&"' From some_table;-> "&cssn"Select ""&cssn&"" From some_table;-> "&cssn&"Select ''&cssn&'' From some_table;-> '&cssn&'

I put double-quotes around the values because I presumed, from your original SQL, that you wanted the string "&cssn&" inserted into your table. I'm not sure why you did, but I just reproduced the SQL code exactly as I read it. But if you were looking to insert form values and not predefined strings, then yes, you would use rs("Cssn") = Request.form("Cssn") :)

Link to comment
Share on other sites

File permissions are little different on the internet, you have to make sure both your folder and database have write permissions. Right-clicking and unchecking the "read-only" box won't do anything, you have to chmod whatever folder your database is sitting in, set it to 660 (if that doesn't work, try chmodding it to 777). Most FTP programs will allow you to do that just by right-clicking on the folder and changing its permissions.If the FTP program won't let you chmod folders, then you have to ask your webhost to do it for you.The part that says "0=1" just tells the database not to return any rows, because you're not using them. If you excluded that part, it would force the entire table into the recordset object for no purpose (which is very resource consuming).I just reproduced the same code from your opening post. When you use this:
Insert into Cform (Cssn,Cjobno,Cfname,Clname,Cphone,Cemail,Cnotes,Cjobref,Cimmsta,Cposition) values ('"&Cssn&"', ...

Its going to insert the "&Cssn&" into your field. You have that string surrounded in both single quotes, and double quotes. Thats just SQL, here are some more examples:

Select "&cssn&" From some_table;-> &cssn&Select '"&cssn&"' From some_table;-> "&cssn"Select ""&cssn&"" From some_table;-> "&cssn&"Select ''&cssn&'' From some_table;-> '&cssn&'

I put double-quotes around the values because I presumed, from your original SQL, that you wanted the string "&cssn&" inserted into your table. I'm not sure why you did, but I just reproduced the SQL code exactly as I read it. But if you were looking to insert form values and not predefined strings, then yes, you would use rs("Cssn") = Request.form("Cssn") :)

Thank you taking the time to respond to my problem. I got that problem fixed. Inititally, it was Guest user permission, I fixed it going through some searching on Windows XP Professional pages. And Regarding the code you gave, actually it didnt work:
rs("Cssn") = """&Cssn&"""

It was going to the database but as "&Cssn&" something like that. It didnt send the value of Cssn to the database. Anyway, I got that working like the one below:

rs("Cssn") = Cssn

and it worked. I dont know if it is correct way of coding but it worked. I have another problem displaying data from the database. Below is my code:result.asp

Set conn = Server.CreateObject("ADODB.Connection")Conn.Open "dsn=Candidate"Set rs1 = Server.CreateObject("ADODB.Recordset")Sqlr="Select * from Cform where Cssn ='"&Cssn&"'" rs1.open Sqlr, conn,3,3If  rs1.EOF Then	Response.write "No Records for SSN"ElseIf not  rs1("Cssn") = "" Then%><table><% Do While Not rs1.EOF %><tr><td>SSN</td><td><%=rs1("Cssn")%></td></tr><tr><td>Job No</td><td><%=rs1("Cjobno")%></td></tr><tr><td>First Name</td><td><%=rs1("Cfname")%></td></tr><tr><td>Last Name</td><td><%=rs1("Clname")%></td></tr></table><%LoopEnd IfEnd ifrs1.closeSet rs1 = nothingconn.closeSet conn = nothing%>

I am using below code because the Cssn field datatype is Text even though it is a number:

where Cssn = '" & Cssn & "'

When I check with Cssn value which is in database, the result page shows as "No record for SSN"

Link to comment
Share on other sites

Can someone please help with code? When I try to run the code, it is going to "No records for SSN". If I dont use the If statament, then I am getting an error message such as :Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.Thanks.

Link to comment
Share on other sites

I think the problem is my sql statement, can someone tell the correct syntax because when I check the response.write sqlr, it gives me:

Select * from Cform where Cssn =''No Records for SSN

database specs:Fieldname - Cssn datatype - text

Link to comment
Share on other sites

Cssn has no value when you use it here:Sqlr="Select * from Cform where Cssn ='"&Cssn&"'"You need to get the value from somewhere (your form maybe) before you use it in the sql statement.

Link to comment
Share on other sites

Cssn has no value when you use it here:Sqlr="Select * from Cform where Cssn ='"&Cssn&"'"You need to get the value from somewhere (your form maybe) before you use it in the sql statement.

You mean, using a request.form statement before the sql statement as:
Cssn = request.form("Cssn")sqlr = "Select * from Cform where Cssn ='"&Cssn&"'"

I have another database question. In my database I have created a field called ID - primary key. And I have given as autonumber - datatype. The problem I see is if I accidently do a refresh also, it creates another record again and again. My question is, is it good to set up field as autonumber - databatype or is there any other way to solve this issue. I dont want to assign Cssn as primary key becoz there might be some records without the Cssn value. Any suggestion? Thanks.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...