Results 1 to 7 of 7
  1. #1
    Join Date
    Oct 2004
    Posts
    26

    Question Unanswered: Unable to use Query in my ASP application

    Hi,

    I have just picked up ASP a month ago and i am learning ASP fast with additional knowledge in C programming, few knowledge in query language and html. However, I receive the same error message whenever I use query language to modify my database , as in using INSERT, UPDATE and DELETE. I attach the add data html and code along with this thread. The database only consist of a table call CDs that has 3 fields of data, which are artist, title and format. Hope someone can give me a hand here. Thanks!

    Error Message:

    Error Type:
    Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
    [Microsoft][ODBC Microsoft Access Driver] Operation must use an updateable query.


    Addcds.htm

    <HTML>
    <FORM METHOD="GET" ACTION="addcds.asp">
    <H3>Add CD to Database</H3>
    <B>Artist</B><BR>
    <INPUT TYPE="TEXT" NAME="artist" MAXLENGTH="50"><P>
    <B>Title</B><BR>
    <INPUT TYPE="TEXT" NAME="title" MAXLENGTH="50"><P>
    <B>Format</B><BR>
    <INPUT TYPE="RADIO" NAME="format" VALUE="CDA" CHECKED> Album<BR>
    <INPUT TYPE="RADIO" NAME="format" VALUE="CDS"> Single<P>
    <INPUT TYPE="SUBMIT" VALUE="Add to database"><P>
    <INPUT TYPE="RESET" VALUE="Clear">
    </FORM>
    </BODY>
    </HMTL>


    Addcds.asp

    <%
    artist=Request("artist")
    title=Request("title")
    format=Request("format")
    Query = "INSERT INTO CDs (artist,title,format) VALUES ("
    Query = Query & "'" & artist & "','" & title & "','" & format & "')"
    Set DataConn = Server.CreateObject("ADODB.Connection")
    DataConn.Open "records"
    Set RSlist = Server.CreateObject("ADODB.recordset")
    RSlist.Open Query,DataConn,3
    %>
    <HTML>
    <BODY>
    <H3>CD Added To Collection Database</H3>
    <HR>
    <SMALL><%=Query%></SMALL>
    </BODY>
    </HTML>
    Last edited by Dniz; 12-18-04 at 03:33.

  2. #2
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    The quick and simple answer is that the user that is running IIS does not have write access to the database....

  3. #3
    Join Date
    Oct 2004
    Posts
    26
    How can I access to my database? Is there any extra configuration in the ODBC? I had been successfully read from the database anyway, using the select function. I assumed it's a backward process to modify the database. Have I got the idea wrong?

  4. #4
    Join Date
    Jun 2003
    Location
    USA
    Posts
    1,032
    Perhaps this might help:

    Why do I get database-related 80004005 errors?
    http://www.aspfaq.com/show.asp?id=2009
    J. Paul Schmidt, Freelance Web and Database Developer
    www.Bullschmidt.com
    Access Database Sample, Web Database Sample, ASP Design Tips

  5. #5
    Join Date
    Oct 2004
    Posts
    26
    Would you recommend me to format my PC? I tried install and unsinstalled IIS in my computer a few times already. Also have all the permission configured. I did the same for other computer but I can used the IIS smoothly without any problem.

  6. #6
    Join Date
    Dec 2003
    Posts
    454
    For the INSERT statement, you need to use Execute(sql) method.

    <%
    Query = "INSERT INTO CDs (artist,title,format) VALUES ("
    Query = Query & "'" & artist & "','" & title & "','" & format & "')"
    Set DataConn = Server.CreateObject("ADODB.Connection")
    DataConn.Open "records"
    DataConn.Execute(Query)
    %>

  7. #7
    Join Date
    Oct 2004
    Posts
    26

    Smile

    Quote Originally Posted by gyuan
    For the INSERT statement, you need to use Execute(sql) method.

    <%
    Query = "INSERT INTO CDs (artist,title,format) VALUES ("
    Query = Query & "'" & artist & "','" & title & "','" & format & "')"
    Set DataConn = Server.CreateObject("ADODB.Connection")
    DataConn.Open "records"
    DataConn.Execute(Query)
    %>
    I've tried the method. Thanks for your suggestion. Actually, I think the problem is with my computer, not the IIS.

Posting Permissions

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