The case effect in Access "ierrorinfo.getdescription because of E_fail (0x80004005) and failed!" "The Solution!

Source: Internet
Author: User
Tags stack trace access database

I'm using an Access database. In order to achieve 1 of the data table "super Administrator", 0 for "News user", I read the data using the case ... when ... Statement:

Select (Case USERCALSS when 1 Then ' super admin ' else ' news user ') from admin

The results of the following error occurred:

Ierrorinfo.getdescription failed because of E_fail (0x80004005).

Note: An unhandled exception occurred during the execution of the current WEB request. Check the stack trace for more information about the error and where the error occurred in the code.

Exception Details: System.Data.OleDb.OleDbException:IErrorInfo.GetDescription failed because of E_fail (0x80004005).

Workaround:

The problem is solved by using the "IIF" function instead of the "case" statement. The SQL statement that implements the above effect is as follows:
Select Id,username,iif (Userclass=1, ' super admin ', ' news Add user ') as UserClass from admin

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.