Solutions for querying and updating access databases in ASP/Asp.net

Source: Internet
Author: User

Here we only use ASP as an example. Asp.net can adjust related statements based on different languages (such as VBScript and C # may be slightly different.

1. database connection failures:

(1) The database connection string is incorrect:

Someone uses:

Connstr = "DBQ =" + server. mappath (".. /data/dbname. mdb ") +"; defaultdir =; driver = {Microsoft Access Driver (*. MDB )};"

This is not quite universal and sometimes errors may occur on some servers. It is better to use the following connection string:

Connstr = "provider = Microsoft. Jet. oledb.4.0; Data Source = '" & server. mappath ("../data/dbname. mdb ")&"'"

(2) sometimes errors may occur. The common cause of errors may be the parent directory of the database, such as the aforementioned ".. /data/dbname. mdb ", which is a database file or a direct database file under a directory in the upper-level directory of the current directory.) due to the IIS settings of Server 2003, you need to right-click the site, select Properties-home directory, and click "Configure". In the applicationProgramClick "enable parent path" on the "options" tab of the configuration ".

 

2. The database connection is correct, but cannot be updated?

Common error messages may be:

(1) Microsoft Jet Database Engine (0x80040e09) cannot be updated. The database or object is read-only.

(2) The Microsoft ole db provider for ODBC drivers (0x80004005) [Microsoft] [ODBC Microsoft Access driver] operation must use an updatable query.

(3) Microsoft Jet Database Engine (0x80004005) must use an updatable query.

Cause:Database permission issues.

There are several solutions as follows (different solutions may be provided for different servers. Here we assume that the home directory of the website is wwwroot ):

A. Right-click the wwwroot folder and choose "properties"> "read-only" from the shortcut menu. This method is simple and occasionally effective.

B. Right-click your database file folder and choose "properties"> "security"> "Add User: "IUSR _ computer name" and open the "IUSR _ computer name" read and write permissions.

Note: You may not be able to see the "Security" option by right-clicking on the XP system. Open "Tools"-"Folder Options"-"View"-and cancel "use simple file sharing" (recommended) then, you can find the "Security" option in the property.

C. Right-click the wwwroot folder and choose "properties"> "Web Sharing"> "shared folder"

 

In server2003, possible errors and solutions are as follows:

Asp.net cannot run, probably because:

1. IIS is not enabled or not installed (solution: install and configure IIS settings );

2. the. NET Framework is not installed (solution: Install. Net-related versions );

3... Net-related services are not enabled (ASP and Asp.net services are enabled in "Computer Management-services and applications-IIS Manager-web service extensions ).

4. path or permission issues (see the preceding section ).

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.