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!

Adding a new record using ADO

Status
Not open for further replies.

tseh

Programmer
Jan 13, 2000
64
CA
I am receiving messages that my &quot;database or object is read-only&quot; when I run the following code:<br><br> 'Add to Database<br> Set rs = Server.CreateObject(&quot;ADODB.Recordset&quot;)<br> rs.open &quot;tblCritique&quot;, cxn,2 , 3<br> rs.AddNew<br> rs(&quot;Critic&quot;) = strCritic<br> rs(&quot;MovieID&quot;) = strMovieID<br> rs(&quot;Comment&quot;) = strComment<br> rs(&quot;Summary&quot;) = strSummary<br> rs(&quot;Value&quot;) = strValue<br> rs.Update<br> rs.Close<br><br>My connection works. I am just trying to add these strings into my database.<br><br>What am I doing wrong?<br><br>Thanks<br>
 
Solution 1:<br>&nbsp;&nbsp;check if 2 , 3 correspond to adOpenDynamic , and adOpenOptimistic respectively. i personally would use &quot;select * from tblCritique&quot;.<br><br>Solution 2: Use cxn.execute &quot;insert into tblcritique (colNames , [..]) values (val1, val2 [..]) &quot;<br><br>The 2nd version is more powerfull.<br><br><br> <p> <br><a href=mailto: > </a><br><a href= </a><br>
 
Your recordset cursor needs to adOpenDynamic, or adOpenOptimistic like the dude before me wrote.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top