Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with Adding new record to ACCESS DB 1

Status
Not open for further replies.

ivan9843

Programmer
Joined
Sep 25, 2003
Messages
19
Location
CA
Hello, Everybody
This is what I get when i am trying to add a new record to a DB:
Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Microsoft Access Driver] Cannot update. Database or object is read-only.
/Opinion.asp, line 30

This is my code:
<%@ Language=VBScript %>
<%option explicit%>
<html>
<head>
</head>
<body bgcolor=&quot;#66ffcc&quot;>
<%
dim cnMyConnection
dim strConnectionString
dim rsMyRecordset


set cnMyConnection = Server.CreateObject(&quot;ADODB.Connection&quot;)
strConnectionString=&quot;Driver={Microsoft Access Driver (*.mdb)};dbq=&quot; & Server.MapPath(&quot;YourOpinion.mdb&quot;)
set rsMyRecordset = Server.CreateObject(&quot;ADODB.Recordset&quot;)



cnMyConnection.Open strConnectionString

rsMyRecordset.Open &quot;YourOpinion&quot;, cnMyConnection, 1 , 2

rsMyRecordset.AddNew
rsMyRecordset.Fields(&quot;Date&quot;) = Request.Form(&quot;txtDate&quot;)
rsMyRecordset.Fields(&quot;FirstName&quot;) = Request.Form(&quot;txtFirst&quot;)
rsMyRecordset.Fields(&quot;LastName&quot;) = Request.Form(&quot;txtLast&quot;)
rsMyRecordset.Fields(&quot;Email&quot;) = Request.Form(&quot;txtEmail&quot;)
rsMyRecordset.Fields(&quot;Message&quot;) = Request.Form(&quot;txtMessage&quot;)
rsMyRecordset.Update ' this is line 30 on the page..
set rsMyRecordset = Nothing
rsMyRecordset.Close
set cnMyConnection = Nothing
cnMyConnection.Close
%>
I think I trying everything...
I am running IIS on WIn XP... anybody have a solution!!!
Thanks ahead...
 
Ivan, why wouldn't you try aspmonster's solution? I'm on Win2K; in fact, I created a little db yesterday, containing one table with all these fields(Date - DateTime, the rest of the fields - text data type), ran the query and it worked fine.
 
Guys, thank you for your help, I an going to believe that this a bug in the system... for two reason:
1) I tried everithing you suggested one at the time... none worked
2) I used to have a different PC with exact same web site on it, with exact same code as before and it worked...:)))
So I will try to instal SQL server and go from there...
Thanks a lot again...
 
Could you post the structure of YourOpinion table, including field data types?
 
Mogu sebe predstavit' kak ty materilsya...
 
eto tochno..:)
privet Slavyanam...:)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top