 |
| 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
|
|
|
|

March 5th, 2007, 03:17 AM
|
|
Authorized User
|
|
Join Date: Mar 2007
Posts: 54
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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!!
|
|

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

March 5th, 2007, 08:12 PM
|
|
Authorized User
|
|
Join Date: Mar 2007
Posts: 54
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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?
|
|

March 5th, 2007, 08:17 PM
|
|
Authorized User
|
|
Join Date: Feb 2007
Posts: 42
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
which sample are you trying? add, delete, update? Does IUSER have proper permissions and access to your db?
|
|

March 5th, 2007, 08:24 PM
|
|
Friend of Wrox
|
|
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
|
|
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
|
|

March 5th, 2007, 08:29 PM
|
|
Authorized User
|
|
Join Date: Mar 2007
Posts: 54
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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!!
|
|

March 5th, 2007, 08:36 PM
|
|
Friend of Wrox
|
|
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
|
|
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
|
|

March 5th, 2007, 08:39 PM
|
|
Authorized User
|
|
Join Date: Feb 2007
Posts: 42
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
also, what OS?
|
|

March 5th, 2007, 08:42 PM
|
|
Authorized User
|
|
Join Date: Feb 2007
Posts: 42
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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.
|
|

March 5th, 2007, 08:58 PM
|
|
Authorized User
|
|
Join Date: Mar 2007
Posts: 54
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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!!
|
|
 |