在C#中使用包含函数

时间:2022-09-02 09:02:11

I am pulling in a excel file to my project everything was working fine but not I have grab all of the cell that contain WMI. I am having trouble with stbQuery does any one know the correct syntax for grabbing information that only contains certain characters.

我正在将一个excel文件提取到我的项目中,一切正常,但我没有抓住所有包含WMI的单元格。我在使用stbQuery时遇到问题,任何人都知道获取仅包含某些字符的信息的正确语法。

OleDbConnection con = new OleDbConnection ("provider=Microsoft.Jet.OLEDB.4.0;data source=" + txtFileName.Text + ";Extended Properties=Excel 8.0;");

StringBuilder stbQuery = new StringBuilder();
stbQuery.Append("Select  [Wireless Number (uneditable)], [* Last Name] FROM [" + txtSheets.Text + "$] WHERE [* Last Name] = LIKE '%WMI%' ");

1 个解决方案

#1


0  

This is an SQL Syntax - LIKE Issue.

这是一个SQL语法 - LIKE问题。

The LIKE Keyword doesn't need an = in Structured Query Language.

LIKE关键字在结构化查询语言中不需要=。

Example:

SELECT * FROM Customers
WHERE [* Last Name] LIKE 's%';

UPDATE

Look at D Stanley Comment.

看看D Stanley评论。

#1


0  

This is an SQL Syntax - LIKE Issue.

这是一个SQL语法 - LIKE问题。

The LIKE Keyword doesn't need an = in Structured Query Language.

LIKE关键字在结构化查询语言中不需要=。

Example:

SELECT * FROM Customers
WHERE [* Last Name] LIKE 's%';

UPDATE

Look at D Stanley Comment.

看看D Stanley评论。