Unable to insert record into access database in asp

Posted on 2006-05-05
Last Modified: 2006-11-18

I have a page nido_new.asp from which I key in the relevant information or select information from  database-retreived records. This page will direct to another page nido_new_ins.asp. In this page I have an include file as below:

<!--#include file="../common/connection.asp"-->

The connection.asp consist of the following code:

dim oDBConn
set oDBConn=Server.CreateObject("ADODB.Connection")
'Common Server  Connection  
oDBConn.Open "DSN=pacdbs;uid=;password="


In nido_new_ins, I retrive the form variables fron nido_new and put them into an sql statement.

When I try to write to access database using the following command:

sqlcmd="Insert into pacdo (pacdoid,orderfulfilmentprefix,orderfulfilmentid,do_accountid,do_calldate,do_calltimehh,do_calltimemm,do_calltypeid," & _
       "do_memberid,do_ctrequestorname,do_tripchargeid,do_workorderid,do_workordertypeid,do_appointmentdate,do_appointmenttimehh,do_appointmenttimemm,do_appointmenttimetypeid, " & _
       "do_sitename,do_siteaddress1,do_siteaddress2,do_engineercode,do_engineername,do_engineercontact,do_specialinstruction,countryid,regdate,deleteflag,pacstatusflag)" & _
       "values(" & pacdoid & ",'" & orderfulfilmentprefix & "'," & orderfulfilmentid & "," & accountid & ",#" & calldate & "#," & calltimehh & "," & _
       calltimemm & "," & calltypeid & "," & memberid & ",'" & ctrequestorname & "'," & tripchargeid & ",'" & workorderid & "'," & workordertypeid & ",#" & _
       appointmentdate & "#," & appointmenttimehh & "," & appointmenttimemm & "," & appointmenttimetype & ",'" & sitename & "','" & siteaddress1 & "','" & siteaddress2 & "','" & engineercode & "','" & _
       engineername & "','" & engineercontact & "','" & specialinstruction & "'," & countryid & ",#" & regdate & "#,0,0)"

oDBConn.Execute sqlcmd

I get an error an error below:

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Microsoft Access Driver] Operation must use an updateable query.
/pacsol/admin/sys/table_change/nido/nido_new_ins.asp, line 65

Maybe because of access rights issue? Anybody can give suggestions on how to solve this problem?
There was no problem retreiving records from database, but when I try to insert new record the error occurs.

Many thanks in advance.

Question by:thaishin
    LVL 16

    Accepted Solution

    Hi there thaishin,

    Have a look here:

    I believe you may be most interested the bit wheich explains how to open a database in the correct mode for Writing back to.

    LVL 6

    Expert Comment

    As Wadski told.

    You should add IUSR_YOURCOMPUTERNAME user and give write privilages to the folder where your ACCESS database resides. You can do this in Security tab of your folders properties.
    LVL 142

    Expert Comment

    by:Guy Hengel [angelIII / a3]
    >Insert into pacdo
    >Operation must use an updateable query.

    is pacdo a table or a view?

    if it is a view, you cannot do it, you have to split the insert into a single insert per table

    Author Comment

    thanks for the help

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
    This demonstration started out as a follow up to some recently posted questions on the subject of logging in: and…
    how to add IIS SMTP to handle application/Scanner relays into office 365.
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now