简体   繁体   English

如何从C#中的Excel工作表中选择行

[英]how to select rows from excel sheet in c#

Hi I have written a code to read from excel sheets and query them according to filter set But am stuck at 嗨,我编写了一个代码,以从excel工作表中读取并根据过滤器集对其进行查询,但被困在

Select * from [sheetname] where [col] not like '%something%'

How can I write the not part? 我该如何写非部分? Rest all query just work fine The one above ignores the not and executes 其余所有查询都可以正常工作上面的一个忽略了并执行

If you don't have to use ADO and OLE to read your spreadsheet, I would recommend using EP Plus . 如果您不必使用ADO和OLE来读取电子表格,则建议使用EP Plus It's a project that allows you to work with Spreadsheets in a much better OOP paradigm. 这个项目使您可以在更好的OOP范例中使用电子表格。 It also abstracts all of the gotchas that come from the different internal formatting of .xlsx files versus the older .xls files. 它还抽象了所有来自.xlsx文件与旧版.xls文件内部格式不同的陷阱。

Is it just you don't have quotes around %something% ? 只是您在%something%附近没有引号吗?

Check out this if you want to melt your brain with Excel possibilities (search the comments for 'not like'), and perhaps solve your problem at the same time. 看看这个 ,如果你想融化与Excel可能你的大脑(搜索“不喜欢”的评论),也许在同一时间解决您的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM