How to Use filter to filter out empty query Fields

Source: Internet
Author: User
How to Use filter to filter out empty query fields Delphi/Windows SDK/API
Http://www.delphi2007.net/DelphiDB/html/delphi_20061225155329114.html
To filter records whose field value is null
Paradox table, using query
Set filter: = 'field name = null'
Cannot Execute?

Filter: = 'field name in null'

Filter = 'fieldname is null'



In access, fieldname = NULL is written in this way.

It seems that is not good ^-^ !!!

Use =
as an example:
the data table structure is as follows: Table Name, temp
A Value Type
B text
Code :
with query1 DO
begin
close;
SQL. clear;
SQL. add ('select * from temp ');
filter: =' B = null';
filtered: = true; // It is estimated that you did not write this
open;
end;

B. If it is a text type, it cannot be used in sqlserver.
Use this judgment: datalength (B)> 0

Filter: = 'B = null ';
Filtered: = true; // It is estimated that you did not write this
Open;
No, I tried filtered: = true. I have already written
B is char type, and filter: = 'B = ''' is acceptable, but an error is returned when null is used.
Capbility can not supported
Is, in none
Paradox table


Create a new table as shown in my example,

The data table structure is as follows: Table Name, temp
Field name a numeric type primary key
Field name B text
The database is a paradox table.

Enter some test data
Create a project in Delphi. Do not use the code below. But there is no problem on my machine.
The Code is as follows:
With query1 do
Begin
Close;
SQL. Clear;
SQL. Add ('select * from temp ');

Filter: = 'B = null ';
Filtered: = true; // It is estimated that you did not write this
Open;
End;

You can create a new table,
I will try again to find the reason,
In addition, how to filter out records that are null or trim (filed. Value) = ''?

The field is null, which can be

Find the cause. When the SQL statement is added with the where condition and the condition is date type, and the parambyname () of the query is used as the method for passing parameters, the null error is used, instead of sdate =: if you add sd1 directly, no error will occur if you use NULL for filtering.

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.