ASP 101 - Active Server Pages 101 - Web05
The Place ASP Developers Go!

Please visit our partners

Windows Technology Windows Technology
15 Seconds
ASP 101
ASP Wire
VB Forums
VB Wire
internet.commerce internet.commerce
Partners & Affiliates

ASP 101 is an site
ASP 101 is an site
Internet News
Small Business
Personal Technology

Corporate Info
Tech Jobs
E-mail Offers

ASP 101 News Flash ASP 101 News Flash

FAQ for the Database Add sample:

I keep getting "Cannot update. Database or object is read-only." What's going on?

This is normally caused by the NTFS permissions on an Access database not allowing the user write access to the .mdb file. I have also seen situations where the permissions on the file are fine, but the directory it's in is locked down so tightly that the Jet engine can't create it's temporary files.

The user account in question is usually named something like IUSR_machine-name and it needs write permissions to the file/directory. You can modify NTFS permissions by using Windows Explorer and right clicking on the object whose permissions you wish to modify and selecting Properties. In the resulting dialog box there should be a Security tab. This is the place to make NTFS security setting changes.

If you don't have access to Windows Explorer on your web server, you'll need to contact whoever is in charge of the server and see what they have set up. Most hosting companies either have a specific area set up for this type of file or have a control panel of some sort that will let you change these settings, but it all depends on how they've got things set up.

There's a reference to in the code. What is it, why doesn't it work without it, and where can I get it?

When writing database related code in ASP, you're really using ADO (ActiveX Data Objects) which is Microsoft's set of components which provide programmatic database access. ADO defines a lot of different constants which you can use to make code more readable and easier to follow and debug. In order to use these constants in VBScript you need to define them. This is where comes in.

The file contains a list of the ADO constants and their numerical equivilents and when included in your ASP code, it defines them as constants so you have access to them in your code. There are a lot of these constants and most of our code is relatively simple database code so it only uses a few of them, but some you might recognize are adOpenStatic, adLockReadOnly, adCmdText, etc...

The reason the code doesn't work when you forget to include the file is that the constants the code uses aren't defined. The result is that incorrect values get passed to ADO and it doesn't know what to do with them.

In terms of getting a copy, you probably already have one! Do a search on your system for and you'll almost certainly find the copy that was installed with ADO. If you can't find one you can get a copy of the one I'm currently using for the samples from here.

For more information about you might want to read our article What is and Why Do I Need It?

I added a record and somehow there are less than before I added it!

This is a "housekeeping" measure I built into the script to keep the number of records under control. I figured most visitors would find it annoying to have to scroll through pages of records in order to see the one they just entered. Because of this, when the record count gets to a certain value I automatically delete some of the old records. Another reason for apparently unexplained activity is that the three samples in the Add / Update / Delete set share the same database. As such, it's quite possible for someone to be changing data from one of the other samples (or even from the same one you're currently using!) at the same time you're using it.

Was your question not answered above?

Ask a new question

Please note: This form is only for submitting questions about the sample for us to consider including in the FAQ. If we feel the question merits inclusion, we will include it along with a reply. We will not respond to your email individually.

Home |  News |  Samples |  Articles |  Lessons |  Resources |  Forum |  Links |  Search |  Feedback
The Network for Technology Professionals



Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers