Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Basics
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 5th, 2004, 01:54 PM
Registered User
 
Join Date: May 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Sunday Ironfoot
Default ASP 3.0 - Problems Inserting into Database w/ SQL

I'm currently following my Wrox Beginning ASP 3.0 book, and I'm upto the bit on inserting data INTO databases. I have an example from the book (chapter 14, page 603) that WILL NOT work, here's the code:

<%
    Option Explicit
    Dim strConnect
%>

<!-- metadata type = "typelib"
    file = "C:\Program Files\Common Files\System\ado\msado15.dll" -->

<html>
<head>
<title>ADO Command Object</title>
</head>
<body>

<%
    Dim objRS, objComm, intNoOfRecords
    Set objComm = Server.CreateObject("ADODB.Command")

    objComm.ActiveConnection = strConnect
    objComm.CommandText = "INSERT INTO Movies(MovieID, Title) VALUES (333, 'Psycho')"
    objComm.CommandType = adCmdText
    objComm.Execute intNoOfRecords

    Response.Write "The INSERT command has been executed; Number of records inserted = " & intNoOfRecords & ""

    objComm.CommandText = "SELECT * FROM Movies WHERE Title LIKE 'Psycho'"
    Set objRS = objComm.Execute

    Response.Write "The SELECT command has been executed, " & _
            "and has selected the following records: <br>"

    While Not objRS.EOF
        Response.Write "MovieID = " & objRS("MovieID") & _
                "; Title = " & objRS("Title") & "<br>"
        objRS.MoveNext
    Wend

    objRS.Close
    Set objRS = Nothing

    objComm.CommandText = "DELETE FROM Movies WHERE Title LIKE 'Psycho'"
    objComm.Execute intNoOfRecords

    Response.Write "The DELETE command has been executed, " & _
            "Number of records deleted = " & intNoOfRecords & "<br>"

    Set objComm = Nothing
%>

</body>
</html>



All the syntax should be correct as it's taken directly from the Wrox website. It says "Page Cannot be displayed" and I get the following error message:

Error Type:
Microsoft JET Database Engine (0x80004005)
Operation must use an updateable query.
/asp_test/SQLInsertDelete.asp, line 20


What could be wrong? I can retrieve data from the database just fine using SQL SELECT statements, just when I try to change data it won't let me. Please please help!!

Thank you!

Sunday Ironfoot
 
Old May 5th, 2004, 02:41 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Hello,

I'm assuming the database is access? I've seen this error a couple times related to permissions problems. In IIS, what permissions are you using (anonymous or windows integrated), and does the user accessing the database have permissions to the access database or the folder that it is in?

Brian





Similar Threads
Thread Thread Starter Forum Replies Last Post
download data ("image") from SQL database problems alex9183 Classic ASP Databases 2 September 14th, 2006 09:02 AM
download data ("image") from SQL database problems dcleslie Classic ASP Databases 9 August 29th, 2006 01:10 PM
inserting data into Sql Database CodeMonkeys C# 6 August 31st, 2004 04:21 PM
Inserting "Double Quotes" ASP?VBScript/SQL Server craigcsb Classic ASP Databases 1 July 4th, 2003 10:37 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.