Can't Add New

Results 1 to 3 of 3

Thread: Can't Add New

  1. #1
    Join Date
    Dec 1969

    Default Can't Add New

    Hi there.<BR>Here at home, I have PWS, and I&#039;m using the following code to add a new entry to a database:<BR><BR>if len(strcomments)&#062;0 then<BR>objConn.BeginTrans <BR>objConn.execute "INSERT INTO graffiti(name, comments) VALUES (&#039;" & replace(strname,"&#039;","&#039;&#039;") & "&#039;,&#039;" & replace(strcomments,"&#039;","&#039;&#039;") & "&#039;)"<BR>objConn.CommitTrans<BR>end if<BR><BR>By the way, strcomments is a value from a form. Anyways, this works perfectly fine here at home. When I uploaded my pages to my host, which has a Windows 2000 IIS 5 Server, I get this error:<BR><BR>Microsoft OLE DB Provider for ODBC Drivers error &#039;80004005&#039; <BR><BR>[Microsoft][ODBC Microsoft Access Driver] Operation must use an updateable query. <BR><BR>/graffiti/default.asp, line 117 <BR><BR>Line 117 is that SQL INSERT query you see above. <BR><BR>I&#039;ve also tried this:<BR><BR>objrs.addnew<BR>objrs.fields("name") = strname<BR>objrs.fields("comments") = strcomments<BR>objrs.update<BR><BR>but neither PWS here nor IIS there "supports" it.<BR><BR>I&#039;d appreciate any help I get with this. <BR>Thank you in advance.

  2. #2
    Join Date
    Dec 1969

    Default RE: Can't Add New

    check out..<BR>

  3. #3
    Join Date
    Dec 1969

    Default Try this code

    Don&#039;t forget to include "ADOVBS.INC" and Change the "DSN&#039; to a valid one. if not using a DSN the write the connectionstring there. Will work with both PWS & IIS<BR><BR><BR>&#060;!--#include file=""--&#062;<BR>&#060;%<BR> Dim strname, strcompname<BR> <BR> strname=request.form("Name")<BR> strcompname=request.form("CompName")<BR> <BR> Dim objConn, objRs<BR> set objConn=server.createobject("ADODB.connection")<BR > objConn.connectionstring="DSN=contact"<BR><BR> <BR> set objRs=server.createobject("ADODB.recordset")<BR> "contact",objConn,adopendynamic,adlockoptimistic,a dcmdtable<BR> <BR> objRs.addnew<BR> objRs("name")=strname<BR> objRs("compname")=strcompname<BR> objRs.update<BR> <BR> objRs.close<BR> set objRs=nothing<BR> objConn.close<BR> set objConn=nothing<BR> <BR> <BR>%&#062;

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts