Resolves an issue in which SQL queries handle Null values when accessing a database with ADO in VB (using IFF (isNull (field), null value, not NULL value))

Source: Internet
Author: User

The environment of the program is VB6 + ADO + Access, when you query with SQL statements, you want to combine two fields into one field, but one of the null values in one field directly causes two fields to merge and become null values. Before can only use VB in the IsNull respectively processing the value of two fields, the previous time want to try to solve with SQL statement directly, did not succeed, almost give up the occasion to find the answer, summarized as follows:

Objective :

Implementing Select (Field 1 + field 2) as A

Questions :

Field 2 if NULL (NULL), the value of a is a null value regardless of whether the value of field 1 is empty (null)

Solution :

1. In Access, you can use Nz (the field, the value of NULL) to handle

2. In VB6 + database, use IFF (isNull (field), null value, not NULL value) to handle

Resolves an issue in which SQL queries handle Null values when accessing a database with ADO in VB (using IFF (isNull (field), null value, not NULL value))

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.