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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

read-only database problem....

Status
Not open for further replies.

fergman

Technical User
Oct 19, 2000
91
US
I've run into a snag writing data from a text form field (T1). The error is cannot open. Database or object is read-only. I've browsed through and found one fix but it didn't seem to work on my setup. Thanks
-Fergman

<%
name = server.HtmlEncode(request.form(&quot;T1&quot;))
Set Conn = Server.CreateObject(&quot;ADODB.Connection&quot;)
Conn.Provider = &quot;Microsoft.Jet.OLEDB.4.0&quot;
Conn.ConnectionString = &quot;Data Source=&quot; & Server.MapPath (&quot;fpdb/chamber.mdb&quot;)
Conn.Open

Set Rs = Server.CreateObject(&quot;ADODB.Recordset&quot;)
Rs.Open &quot;SELECT * from Results&quot;, Conn, 1,3
Rs.addnew 'this line is where the error points
Rs(&quot;1_business_referrals&quot;) = name
Rs.update

set Rs = nothing
set Conn = nothing


%>
 
Hello,
Look at some of suggestions in thread333-34262.
D.
 


fergman,

First I would see if you can read from the databas. At least then you'll know if you had a good connection. Then try writing to it. I would also try and trap the error.

Set Rs = Server.CreateObject(&quot;ADODB.Recordset&quot;)
Rs.Open &quot;SELECT * from Results&quot;, Conn, 1,3
On Error Resume Next
Rs.addnew 'this line is where the error points

If err.number <> 0 then
response.write &quot;Error is: &quot; & err.number & _
&quot; Description: &quot; & err.description
response.end
End if

Rs(&quot;1_business_referrals&quot;) = name
Rs.update

Fegnshui1998


 
Thanks, this is what the error generates

Error is: -2147217911 Description: Cannot update. Database or object is read-only.
and I am able to read from the database, but I still cannot write to it.
 


fergman,

Try using this connection string if you have a UID and password.


Conn.Open &quot;PROVIDER=Microsoft.Jet.OLEDB.3.51;&quot; & _
&quot;DATA SOURCE=C:\...\NWind.mdb;&quot; & _
&quot;USER ID=admin;PASSWORD=;&quot;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top