Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP 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 March 5th, 2007, 03:17 AM
Authorized User
 
Join Date: Mar 2007
Posts: 54
Thanks: 0
Thanked 0 Times in 0 Posts
Default Add, update and deletes..

Can anyone help me with examples of add, update and deletes? I've got add working with the below. What I need are examples of how to update or delete a record based on Request.Form("frm_cname").

BTW, what would be the easiest way to just use a SQL statement?

Sorry to ask, but I've been leaning by example. If this was in SQL, I know how to get this to work, but using an Access DB is a PITA!

<%
Dim objCommand
Dim objRec
Set objCommand = Server.CreateObject ("ADODB.Command")
Set objRec = Server.CreateObject ("ADODB.Recordset")

strConnect = "Driver={Microsoft Access Driver (*.mdb)}; DBQ=d:\www\signup.mdb"

objRec.Open "tablename", strConnect, 3, 3, 2

    objRec.AddNew
    objRec("TIME") = Now()
    objRec("LOCATION") = Request.Form("frm_loc")
    objRec("CLIENT") = Request.Form("frm_cname")

    objRec.Update

    objRec.Close
    Set objRec = Nothing
    Set objCommand = Nothing
%>

Thanks All!!
 
Old March 5th, 2007, 07:37 PM
Authorized User
 
Join Date: Feb 2007
Posts: 42
Thanks: 0
Thanked 0 Times in 0 Posts
Default

http://www.w3schools.com/ado/ado_add.asp
http://www.w3schools.com/ado/ado_update.asp
http://www.w3schools.com/ado/ado_delete.asp

 
Old March 5th, 2007, 08:12 PM
Authorized User
 
Join Date: Mar 2007
Posts: 54
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Solos,

I looked at the samples and tried them as shown after I created the sample Northwind db. I keep getting the error in about permissions. I took the error sub out of the example to see the error and I get this:

Error Type:
Microsoft JET Database Engine (0x80004005)
Operation must use an updateable query.

The error occurs here: conn.Execute sql

Any idea on how to get around this?


 
Old March 5th, 2007, 08:17 PM
Authorized User
 
Join Date: Feb 2007
Posts: 42
Thanks: 0
Thanked 0 Times in 0 Posts
Default

which sample are you trying? add, delete, update? Does IUSER have proper permissions and access to your db?

 
Old March 5th, 2007, 08:24 PM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

crabjoe - That error indicates you have not granted permissions to the IUSR on the dir where your .mdb file is

Right click this dir / properties / security / [place the IUSR in the list and give him read and write]

Wind is your friend
Matt
 
Old March 5th, 2007, 08:29 PM
Authorized User
 
Join Date: Mar 2007
Posts: 54
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Guys,

There's security option on the folder for me to pick who or what type of access will be given. Because of this, made IUSR an administrator, but I still get the same error.

I'm testing this on the Update example, but I get the same error on adds and deletes. I'm also testing this on my laptop here at home running XP Pro with a full version of IIS installed.

BTW, I as able to take the read only attribute off the directory (Still doesn't work). What's weird is there's no security option like I'm used to seeing under properties. Also, I can read the data in the tables without any issues, it's just add, update and deletes don't work based on the example.

Thanks for your help!!
 
Old March 5th, 2007, 08:36 PM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

When you say 'made IUSR an administrator' do you mean you gave him full control? If so, check the .mdf file is not set to read only. If not, are you sure you clicked 'Apply' to set the changes?

Check the permissions stuck. Shut down any browsers you have open, open a fresh browser and try.

BTW: there is no need to grant full control. Once its going trim the permissions back to read and write, these are all you should need

Wind is your friend
Matt
 
Old March 5th, 2007, 08:39 PM
Authorized User
 
Join Date: Feb 2007
Posts: 42
Thanks: 0
Thanked 0 Times in 0 Posts
Default

also, what OS?

 
Old March 5th, 2007, 08:42 PM
Authorized User
 
Join Date: Feb 2007
Posts: 42
Thanks: 0
Thanked 0 Times in 0 Posts
Default

if there's no "security tab" click on tools/folder options/view/ scroll all the way to the bottom and uncheck "enable simple file sharing"

security tab will appear in properties.

 
Old March 5th, 2007, 08:58 PM
Authorized User
 
Join Date: Mar 2007
Posts: 54
Thanks: 0
Thanked 0 Times in 0 Posts
Default

THANK YOU EVERYONE FOR YOUR HELP!!

I got it working. The trick was getting the security tab working based on solos instructions. Once I got that I was able to see the security setting for the folder and the database.

THANKS AGAIN!!






Similar Threads
Thread Thread Starter Forum Replies Last Post
How can i add constraint on update cascade without mahen_pali SQL Server 2005 1 May 3rd, 2008 03:28 PM
Update Query to add a count of +1 melkin Classic ASP Databases 3 August 7th, 2007 11:59 AM
VS 2002 Deletes Code! RickDagger BOOK: ASP.NET Website Programming Problem-Design-Solution 6 January 12th, 2006 01:01 AM
Stored procedure that deletes given SP filipczako SQL Language 8 December 9th, 2005 08:37 AM
Deletes Louisa VB.NET 2002/2003 Basics 3 July 13th, 2004 06:40 AM





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