Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 5th, 2007, 03:17 AM
Authorized User
Points: 254, Level: 5
Points: 254, Level: 5 Points: 254, Level: 5 Points: 254, Level: 5
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2007
Location: , , .
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!!
Reply With Quote
  #2 (permalink)  
Old March 5th, 2007, 07:37 PM
Authorized User
 
Join Date: Feb 2007
Location: , , .
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

Reply With Quote
  #3 (permalink)  
Old March 5th, 2007, 08:12 PM
Authorized User
Points: 254, Level: 5
Points: 254, Level: 5 Points: 254, Level: 5 Points: 254, Level: 5
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2007
Location: , , .
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?


Reply With Quote
  #4 (permalink)  
Old March 5th, 2007, 08:17 PM
Authorized User
 
Join Date: Feb 2007
Location: , , .
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?

Reply With Quote
  #5 (permalink)  
Old March 5th, 2007, 08:24 PM
Friend of Wrox
Points: 6,664, Level: 34
Points: 6,664, Level: 34 Points: 6,664, Level: 34 Points: 6,664, Level: 34
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2004
Location: Sydney, NSW, Australia.
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
Reply With Quote
  #6 (permalink)  
Old March 5th, 2007, 08:29 PM
Authorized User
Points: 254, Level: 5
Points: 254, Level: 5 Points: 254, Level: 5 Points: 254, Level: 5
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2007
Location: , , .
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!!
Reply With Quote
  #7 (permalink)  
Old March 5th, 2007, 08:36 PM
Friend of Wrox
Points: 6,664, Level: 34
Points: 6,664, Level: 34 Points: 6,664, Level: 34 Points: 6,664, Level: 34
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2004
Location: Sydney, NSW, Australia.
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
Reply With Quote
  #8 (permalink)  
Old March 5th, 2007, 08:39 PM
Authorized User
 
Join Date: Feb 2007
Location: , , .
Posts: 42
Thanks: 0
Thanked 0 Times in 0 Posts
Default

also, what OS?

Reply With Quote
  #9 (permalink)  
Old March 5th, 2007, 08:42 PM
Authorized User
 
Join Date: Feb 2007
Location: , , .
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.

Reply With Quote
  #10 (permalink)  
Old March 5th, 2007, 08:58 PM
Authorized User
Points: 254, Level: 5
Points: 254, Level: 5 Points: 254, Level: 5 Points: 254, Level: 5
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2007
Location: , , .
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!!

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 12:26 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.