SQL查询以检查Excel中的空白单元格

时间:2022-01-06 22:17:27

I have data in excel sheet that has two columns and 10 rows. Some of the rows for First column has blank value. Excel shows it as (blank) on putting aut filter on colunm

我在excel表中有两列和10行的数据。 First列的某些行具有空值。 Excel将自动过滤器放在colunm上时显示为(空白)

I am querying the excel sheet from C# 2.0 to find out if first column contains a blank.

我正在查询C#2.0中的Excel工作表,以确定第一列是否包含空白。

select * from [Sheet1$] where [Myname] = \"\"";

从[Sheet1 $]中选择*,其中[Myname] = \“\”“;

The above query is not returning any records, so I tried the query below.

上面的查询没有返回任何记录,所以我尝试了下面的查询。

select * from [Sheet1$] where [Myname] = \" \"";

从[Sheet1 $]中选择*,其中[Myname] = \“\”“;

This either is not returning any rows. I also tried with value NULL in the where clause , but it is also not working.

这要么不返回任何行。我也尝试在where子句中使用NULL值,但它也无效。

Can anyone help me to write the correct query to check for blank fields in excel?

任何人都可以帮我写出正确的查询来检查excel中的空白字段吗?

Thanks

1 个解决方案

#1


2  

select * from [Sheet1$] where [Myname] IS NULL

This seems to work fine using System.Data.OleDb.

使用System.Data.OleDb似乎可以正常工作。

#1


2  

select * from [Sheet1$] where [Myname] IS NULL

This seems to work fine using System.Data.OleDb.

使用System.Data.OleDb似乎可以正常工作。